diff --git "a/assets/index-DY9zGeUA.js" "b/assets/index-DY9zGeUA.js" deleted file mode 100644--- "a/assets/index-DY9zGeUA.js" +++ /dev/null @@ -1,6655 +0,0 @@ -var ni=Object.defineProperty;var ui=(r,e,t)=>e in r?ni(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Vr=(r,e,t)=>ui(r,typeof e!="symbol"?e+"":e,t);import{o as openBlock,c as createElementBlock,e as renderSlot,d as defineComponent,f as ref$1,w as watch,g as useEventListener,h as onMounted,i as onUnmounted,j as createBaseVNode,n as normalizeStyle,k as createCommentVNode,l as defineStore,m as useLocalStorage,p as computed,q as useDevicesList,s as i18n,t as createBlock,v as withCtx,T as Transition,x as useI18n,y as useDark,z as storeToRefs,A as normalizeClass,b as unref,B as withDirectives,C as vModelRadio,D as vModelCheckbox,a as createVNode,E as toDisplayString,F as vModelText,G as vModelSelect,H as Fragment,I as renderList,J as isRef,K as getAugmentedNamespace,L as defu,M as usePermission,N as toRef,O as tryOnMounted,P as useWebWorker,Q as getDefaultExportFromCjs,R as useElementBounding,S as useScroll,U as nextTick,V as resolveDirective,W as reactive,X as effectScope,Y as mergeProps,Z as normalizeProps,_ as guardReactiveProps,$ as useId,a0 as h,a1 as toRefs,a2 as Teleport,a3 as inject,a4 as provide,a5 as toHandlerKey,a6 as camelize,a7 as getCurrentInstance,a8 as Comment,a9 as cloneVNode,aa as onBeforeUnmount,ab as watchEffect,ac as getCurrentScope,ad as onScopeDispose,ae as useSlots,af as commonjsGlobal,ag as useBreakpoints,ah as useDebounceFn,ai as breakpointsTailwind,aj as useWindowSize,ak as BufferGeometry,al as InterleavedBuffer,am as InterleavedBufferAttribute,an as MathUtils,ao as Color,ap as Vector3,aq as ShaderMaterial,ar as UniformsUtils,as as BackSide,at as Triangle,au as Euler,av as Ray,aw as Plane,ax as me,ay as shallowRef,az as TOUCH,aA as Zr,aB as Matrix4,aC as PlaneGeometry,aD as useAttrs,aE as render,aF as DoubleSide,aG as Box3,aH as UniformsLib,aI as Vector2,aJ as ShaderLib,aK as Vector4,aL as Line3,aM as Sphere,aN as Mesh,aO as MeshBasicMaterial,aP as FramebufferTexture,aQ as RawShaderMaterial,aR as AdditiveBlending,aS as Box2,aT as UnsignedByteType,aU as REVISION,aV as PropertyBinding,aW as InterpolateLinear,aX as EventDispatcher,aY as MOUSE,aZ as Quaternion,a_ as PerspectiveCamera,a$ as OrthographicCamera,b0 as Spherical,b1 as WebGLRenderTarget,b2 as HalfFloatType,b3 as NoToneMapping,b4 as BoxGeometry,b5 as CompressedTexture,b6 as Texture$1,b7 as RGBAFormat,b8 as BufferAttribute,b9 as InterpolateDiscrete,ba as Scene,bb as ShapePath,bc as Uniform,bd as WebGLRenderer,be as NearestFilter,bf as NearestMipmapNearestFilter,bg as NearestMipmapLinearFilter,bh as LinearFilter,bi as LinearMipmapNearestFilter,bj as LinearMipmapLinearFilter,bk as ClampToEdgeWrapping,bl as RepeatWrapping,bm as MirroredRepeatWrapping,bn as mergeModels,bo as useModel,bp as createTextVNode,bq as Object3D,br as AnimationClip,bs as QuaternionKeyframeTrack,bt as NumberKeyframeTrack,bu as Matrix3,bv as Skeleton,bw as Group,bx as LineBasicMaterial,by as LineSegments,bz as ImageLoader,bA as Material,bB as AxesHelper,bC as TangentSpaceNormalMap,bD as DynamicDrawUsage,bE as Line,bF as SkinnedMesh,bG as GLBufferAttribute,bH as TrianglesDrawMode,bI as TriangleFanDrawMode,bJ as TriangleStripDrawMode,bK as Loader,bL as LoaderUtils,bM as FileLoader$1,bN as LinearSRGBColorSpace,bO as SpotLight,bP as PointLight,bQ as DirectionalLight,bR as SRGBColorSpace,bS as MeshPhysicalMaterial,bT as InstancedMesh,bU as InstancedBufferAttribute,bV as TextureLoader,bW as ImageBitmapLoader,bX as PointsMaterial,bY as MeshStandardMaterial,bZ as LineLoop,b_ as Points,b$ as Bone,c0 as ColorManagement,c1 as FrontSide,c2 as VectorKeyframeTrack,c3 as Interpolant,c4 as AnimationMixer,c5 as Hr}from"./index-BKI8IDRh.js";import{_ as _export_sfc}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{_ as _sfc_main$k}from"./BasicTextarea.vue_vue_type_script_setup_true_lang-C6oSrryP.js";import{E as EMOTION_VALUES,a as EmotionSurpriseMotionName,b as EmotionSadMotionName,c as EmotionAngryMotionName,d as EmotionHappyMotionName,e as EmotionAwkwardMotionName,f as EmotionQuestionMotionName,g as EmotionThinkMotionName,u as useMessageContentQueue,h as useEmotionsMessageQueue,i as useDelayMessageQueue,l as llmInferenceEndToken,j as EMOTION_VRMExpressionName_value,k as EMOTION_EmotionMotionName_value}from"./queues-CD5SbEUt.js";import{u as useQueue}from"./queue-Cx2ZY-wr.js";const _sfc_main$j={},_hoisted_1$e={class:"cross-background-container"};function _sfc_render$1(r,e){return openBlock(),createElementBlock("div",_hoisted_1$e,[renderSlot(r.$slots,"default",{},void 0,!0)])}const Cross=_export_sfc(_sfc_main$j,[["render",_sfc_render$1],["__scopeId","data-v-ff7347db"]]),_hoisted_1$d={class:"relative"},_hoisted_2$b=["width","height","viewBox"],_hoisted_3$a=["d","fill"],_sfc_main$i=defineComponent({__name:"AnimatedBackground",props:{verticalOffset:{default:20},height:{default:40},amplitude:{default:14},waveLength:{default:250},fillColor:{default:"#f8e8f2"},direction:{default:"down"},animationSpeed:{default:.5}},setup(r){const e=r,t=ref$1(null),n=ref$1(null),i=ref$1(0),a=ref$1(e.height),l=ref$1(e.amplitude),u=ref$1(e.waveLength),d=ref$1(""),f=ref$1(e.fillColor),m=ref$1(e.direction);function s(b,x,w,S,T){const E=[],P=Math.ceil(b/S)*S,A=1,C=T==="up"?x-w:w;E.push(`M 0 ${C}`);for(let D=0;D<=P;D+=A){const k=T==="up"?C-w*Math.sin(2*Math.PI*D/S):C+w*Math.sin(2*Math.PI*D/S);E.push(`L ${D} ${k}`)}return T==="up"?(E.push(`L ${P} ${x}`),E.push(`L 0 ${x} Z`)):(E.push(`L ${P} 0`),E.push("L 0 0 Z")),E.join(" ")}function o(){var b;if(t.value){const x=t.value.clientWidth;i.value=x;const S=Math.ceil(x*2/u.value)*u.value;d.value=s(S,a.value,l.value,u.value,m.value),(b=n.value)==null||b.setAttribute("width",S.toString())}}let c;const v=ref$1(e.animationSpeed),y=ref$1(0);function _(){y.value-=v.value,Math.abs(y.value)>=u.value&&(y.value+=u.value),n.value&&(n.value.style.transform=`translateX(${y.value}px)`),c=requestAnimationFrame(_)}return watch(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction],()=>{a.value=e.height,l.value=e.amplitude,u.value=e.waveLength,f.value=e.fillColor,m.value=e.direction,o()},{immediate:!0}),useEventListener("resize",o),onMounted(()=>{o(),_()}),onUnmounted(()=>{cancelAnimationFrame(c)}),(b,x)=>(openBlock(),createElementBlock("div",_hoisted_1$d,[renderSlot(b.$slots,"default"),createBaseVNode("div",{ref_key:"container",ref:t,absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},[m.value==="down"?(openBlock(),createElementBlock("div",{key:0,style:normalizeStyle({backgroundColor:f.value,height:`${a.value}px`}),"w-full":""},null,4)):createCommentVNode("",!0),(openBlock(),createElementBlock("svg",{ref_key:"svg",ref:n,width:u.value*Math.ceil(i.value*2/u.value),height:a.value,viewBox:`0 0 ${u.value*Math.ceil(i.value*2/u.value)} ${a.value}`,xmlns:"http://www.w3.org/2000/svg",h:"[100%]",w:"[200%]",style:{willChange:"transform"}},[createBaseVNode("path",{d:d.value,fill:f.value},null,8,_hoisted_3$a)],8,_hoisted_2$b)),m.value==="up"?(openBlock(),createElementBlock("div",{key:1,style:normalizeStyle({backgroundColor:f.value,height:`${a.value}px`}),"w-full":""},null,4)):createCommentVNode("",!0)],512)]))}});var Voice=(r=>(r.Myriam="Myriam",r.Beatrice="Beatrice",r.Camilla_KM="Camilla_KM",r.SallySunshine="Sally Sunshine",r.Annie="Annie",r.KawaiiAerisita="Kawaii Aerisita",r.Morioki="Morioki",r))(Voice||{});const voiceMap={Myriam:"lNxY9WuCBCZCISASyJ55",Beatrice:"KAsXoQDshjF6ehsWa1mF",Camilla_KM:"dLhSyo03JRp5WkGpUlz1","Sally Sunshine":"qswttdunP3b44zVZKMRB",Annie:"AfA1PA0ldViH0DA6pbml","Kawaii Aerisita":"vGQNBgLaiM3EdZtxIiuY",Morioki:"8EkOjt4xTPGMclNlh1pk"},enVoiceList=["Myriam","Beatrice","Camilla_KM","Sally Sunshine","Annie","Kawaii Aerisita"],jaVoiceList=["Morioki"],voiceList={en:enVoiceList,"en-US":enVoiceList,ja:jaVoiceList,"ja-JP":jaVoiceList},strCamelToSnake=r=>r.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),objCamelToSnake=r=>Object.fromEntries(Object.entries(r).map(([e,t])=>[strCamelToSnake(e),t])),clean=r=>Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0)),requestBody=r=>JSON.stringify(objCamelToSnake(clean({...r,abortSignal:void 0,apiKey:void 0,baseURL:void 0,fetch:void 0,headers:void 0}))),requestHeaders=(r,e)=>clean({Authorization:e?`Bearer ${e}`:void 0,...r}),requestURL=(r,e)=>{const t=e.toString();return new URL(r,t.endsWith("/")?t:`${t}/`)},listModels=async r=>await(r.fetch??globalThis.fetch)(requestURL("models",r.baseURL),{headers:requestHeaders({"Content-Type":"application/json",...r.headers},r.apiKey),signal:r.abortSignal}).then(e=>e.json()).then(({data:e})=>e);class ChatError extends Error{constructor(t,n){super(t);Vr(this,"response");this.name="ChatError",this.response=n}}const chat=async r=>{var e;return await(r.fetch??globalThis.fetch)(requestURL("chat/completions",r.baseURL),{body:requestBody({...r,tools:(e=r.tools)==null?void 0:e.map(t=>({function:t.function,type:"function"}))}),headers:requestHeaders({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal})},dataHeaderPrefix="data: ",dataErrorPrefix='{"error":',streamText=async r=>await chat({...r,stream:!0}).then(async e=>{if(!e.ok){const m=new ChatError(`Remote sent ${e.status} response`,e);m.cause=new Error(await e.text())}if(!e.body)throw new ChatError("Response body is empty from remote server",e);if(!(e.body instanceof ReadableStream)){const m=new ChatError(`Expected Response body to be a ReadableStream, but got ${String(e.body)}`,e);m.cause=new Error(`Content-Type is ${e.headers.get("Content-Type")}`)}const t=new TextDecoder;let n,i,a="";const l=e.body.pipeThrough(new TransformStream({transform:(m,s)=>{a+=t.decode(m);const o=a.split(` - -`);a=o.pop()||"";for(const c of o){if(!c||!c.startsWith(dataHeaderPrefix))continue;if(c.startsWith(dataErrorPrefix)){s.error(new Error(`Error from server: ${c}`));break}const v=c.slice(dataHeaderPrefix.length);if(v==="[DONE]"){s.terminate();break}const y=JSON.parse(v);s.enqueue(y),y.choices[0].finish_reason&&(n=y.choices[0].finish_reason),y.usage&&(i=y.usage)}}})),[u,d]=l.tee(),f=d.pipeThrough(new TransformStream({transform:(m,s)=>s.enqueue(m.choices[0].delta.content)}));return{chunkStream:u,finishReason:n,textStream:f,usage:i}}),useLLM=defineStore("llm",()=>{async function r(t,n,i,a){return await streamText({baseURL:t.endsWith("/")?t:`${t}/`,apiKey:n,model:i,messages:a,streamOptions:{usage:!0}})}async function e(t,n){if(t==="")return[];try{return await listModels({baseURL:t.endsWith("/")?t:`${t}/`,apiKey:n})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:r}}),useSettings=defineStore("settings",()=>{const r=ref$1(),e=useLocalStorage("settings/language","en-US"),t=useLocalStorage("settings/stage/view/model-renderer","2d"),n=useLocalStorage("settings/credentials/openai-api-key",""),i=useLocalStorage("settings/credentials/openai-api-base-url",""),a=useLocalStorage("settings/credentials/elevenlabs-api-key",""),l=useLocalStorage("settings/llm/openai/model",{id:"openai/gpt-3.5-turbo",name:"OpenAI GPT3.5 Turbo"}),u=useLocalStorage("settings/audio/input","true"),d=computed(()=>{var o;return(o=r.value)==null?void 0:o.deviceId}),{audioInputs:f}=useDevicesList({constraints:{audio:!0},requestPermissions:!0}),m=useLocalStorage("settings/llm/elevenlabs/voice/en",Voice.Myriam),s=useLocalStorage("settings/llm/elevenlabs/voice/ja",Voice.Morioki);return watch(u,o=>{o==="false"&&(r.value=void 0),o==="true"&&(r.value=f.value[0])}),onMounted(()=>{u.value==="true"&&!r.value&&(r.value=f.value[0])}),watch(f,()=>{u.value==="true"&&!r.value&&(r.value=f.value[0])}),watch(e,o=>i18n.global.locale.value=o),{openAiApiKey:n,openAiApiBaseURL:i,openAiModel:l,elevenLabsApiKey:a,language:e,stageView:t,isAudioInputOn:u,selectedAudioDevice:r,selectedAudioDeviceId:d,elevenlabsVoiceEnglish:m,elevenlabsVoiceJapanese:s}}),closed="0px",_sfc_main$h=defineComponent({__name:"TransitionVertical",props:{duration:{default:250},easingEnter:{default:"ease-in-out"},easingLeave:{default:"ease-in-out"},opacityClosed:{default:0},opacityOpened:{default:1}},setup(r){const e=r;function t(d){return{height:d.style.height,width:d.style.width,position:d.style.position,visibility:d.style.visibility,overflow:d.style.overflow,paddingTop:d.style.paddingTop,paddingBottom:d.style.paddingBottom,borderTopWidth:d.style.borderTopWidth,borderBottomWidth:d.style.borderBottomWidth,marginTop:d.style.marginTop,marginBottom:d.style.marginBottom}}function n(d,f){const{width:m}=getComputedStyle(d);d.style.width=m,d.style.position="absolute",d.style.visibility="hidden",d.style.height="";const{height:s}=getComputedStyle(d);return d.style.width=f.width,d.style.position=f.position,d.style.visibility=f.visibility,d.style.height=closed,d.style.overflow="hidden",f.height&&f.height!==closed?f.height:s}function i(d,f,m,s,o){const c=d.animate(s,o);d.style.height=f.height,c.onfinish=()=>{d.style.overflow=f.overflow,m()}}function a(d,f){return[{height:closed,opacity:e.opacityClosed,paddingTop:closed,paddingBottom:closed,borderTopWidth:closed,borderBottomWidth:closed,marginTop:closed,marginBottom:closed},{height:d,opacity:e.opacityOpened,paddingTop:f.paddingTop,paddingBottom:f.paddingBottom,borderTopWidth:f.borderTopWidth,borderBottomWidth:f.borderBottomWidth,marginTop:f.marginTop,marginBottom:f.marginBottom}]}function l(d,f){const m=d,s=t(m),o=n(m,s),c=a(o,s),v={duration:e.duration,easing:e.easingEnter};i(m,s,f,c,v)}function u(d,f){const m=d,s=t(m),{height:o}=getComputedStyle(m);m.style.height=o,m.style.overflow="hidden";const c=a(o,s).reverse(),v={duration:e.duration,easing:e.easingLeave};i(m,s,f,c,v)}return(d,f)=>(openBlock(),createBlock(Transition,{css:!1,onEnter:l,onLeave:u},{default:withCtx(()=>[renderSlot(d.$slots,"default")]),_:3}))}}),_hoisted_1$c={flex:"~","gap-2":""},_hoisted_2$a={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-1":""},_hoisted_3$9=["checked","aria-checked"],_hoisted_4$7=["checked","aria-checked"],_hoisted_5$7={relative:""},_hoisted_6$6={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-1":""},_hoisted_7$5=["checked","aria-checked"],_hoisted_8$5={key:0,w:"120 x.id===_.value);if(!b){d.value=void 0;return}d.value=b}function v(y){const _=y.target.value;switch(t.value){case"en":case"en-US":s.value=_;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":s.value=_;break;case"jp":case"jp-JP":o.value=_;break}}return watch([f,m],async([y,_])=>{if(!y||!_){l.value=[];return}l.value=await u(y,_)}),onMounted(async()=>{!f.value||!m.value||(l.value=await u(f.value,m.value))}),(y,_)=>(openBlock(),createElementBlock("div",_hoisted_1$c,[createBaseVNode("fieldset",_hoisted_2$a,[createBaseVNode("label",{"h-fit":"","cursor-pointer":"",class:normalizeClass([unref(n).stageView==="2d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[0]||(_[0]=b=>unref(n).stageView=b),checked:unref(n).stageView==="2d","aria-checked":unref(n).stageView==="2d",name:"settings.stageView",type:"radio",role:"radio",value:"2d",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_3$9),[[vModelRadio,unref(n).stageView]]),createBaseVNode("div",{"select-none":"",class:normalizeClass([unref(n).stageView==="2d"?"font-semibold":""])}," 2D ",2)],2),createBaseVNode("label",{"h-fit":"","cursor-pointer":"",class:normalizeClass([unref(n).stageView==="3d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[1]||(_[1]=b=>unref(n).stageView=b),checked:unref(n).stageView==="3d","aria-checked":unref(n).stageView==="3d",name:"stageView",type:"radio",role:"radio",value:"3d",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_4$7),[[vModelRadio,unref(n).stageView]]),createBaseVNode("div",{"select-none":"",class:normalizeClass([unref(n).stageView==="3d"?"font-semibold":""])}," 3D ",2)],2)]),createBaseVNode("div",_hoisted_5$7,[createBaseVNode("div",_hoisted_6$6,[createBaseVNode("label",{"h-fit":"","cursor-pointer":"",class:normalizeClass([i.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":""},[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[2]||(_[2]=b=>i.value=b),checked:i.value,"aria-checked":i.value,name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_7$5),[[vModelCheckbox,i.value]]),_[8]||(_[8]=createBaseVNode("div",{"select-none":""},[createBaseVNode("div",{"i-solar:settings-minimalistic-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800 lg"})],-1))],2)]),createVNode(_sfc_main$h,null,{default:withCtx(()=>[i.value?(openBlock(),createElementBlock("div",_hoisted_8$5,[createBaseVNode("div",_hoisted_9$5,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.openai-base-url.label")),1)]),createBaseVNode("div",_hoisted_10$3,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[3]||(_[3]=b=>unref(n).openAiApiBaseURL=b),type:"text",placeholder:unref(e)("settings.openai-base-url.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,_hoisted_11$3),[[vModelText,unref(n).openAiApiBaseURL]])]),createBaseVNode("div",_hoisted_12$3,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.openai-api-key.label")),1)]),createBaseVNode("div",_hoisted_13$3,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[4]||(_[4]=b=>unref(n).openAiApiKey=b),type:"text",placeholder:unref(e)("settings.openai-api-key.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,_hoisted_14$3),[[vModelText,unref(n).openAiApiKey]])]),createBaseVNode("div",_hoisted_15$3,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.elevenlabs-api-key.label")),1)]),createBaseVNode("div",_hoisted_16$3,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[5]||(_[5]=b=>unref(n).elevenLabsApiKey=b),type:"text",placeholder:unref(e)("settings.elevenlabs-api-key.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,_hoisted_17$3),[[vModelText,unref(n).elevenLabsApiKey]])]),createBaseVNode("div",_hoisted_18$3,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.language")),1)]),createBaseVNode("div",_hoisted_19$3,[withDirectives(createBaseVNode("select",{"onUpdate:modelValue":_[6]||(_[6]=b=>unref(n).language=b),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},_[9]||(_[9]=[createBaseVNode("option",{value:"en-US"}," English ",-1),createBaseVNode("option",{value:"zh-CN"}," 简体中文 ",-1)]),512),[[vModelSelect,unref(n).language]])]),createBaseVNode("div",_hoisted_20$3,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.models")),1)]),createBaseVNode("div",_hoisted_21$3,[createBaseVNode("select",{bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":"",onChange:c},[createBaseVNode("option",_hoisted_22$1,toDisplayString(unref(e)("stage.select-a-model")),1),unref(n).openAiModel?(openBlock(),createElementBlock("option",{key:0,value:unref(n).openAiModel.id},toDisplayString("name"in unref(n).openAiModel?`${unref(n).openAiModel.name} (${unref(n).openAiModel.id})`:unref(n).openAiModel.id),9,_hoisted_23$1)):createCommentVNode("",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(l.value,b=>(openBlock(),createElementBlock("option",{key:b.id,value:b.id},toDisplayString("name"in b?`${b.name} (${b.id})`:b.id),9,_hoisted_24$1))),128))],32)]),createBaseVNode("div",_hoisted_25$1,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.voices")),1)]),createBaseVNode("div",_hoisted_26$1,[createBaseVNode("select",{bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":"",onChange:v},[createBaseVNode("option",_hoisted_27$1,toDisplayString(unref(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(unref(t))!==-1&&unref(s)?(openBlock(),createElementBlock("option",{key:0,value:unref(s)},toDisplayString(unref(s)),9,_hoisted_28$1)):createCommentVNode("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(unref(t))!==-1&&unref(s)?(openBlock(),createElementBlock("option",{key:1,value:unref(s)},toDisplayString(unref(s)),9,_hoisted_29$1)):createCommentVNode("",!0),["jp","jp-JP"].indexOf(unref(t))!==-1&&unref(o)?(openBlock(),createElementBlock("option",{key:2,value:unref(o)},toDisplayString(unref(o)),9,_hoisted_30$1)):createCommentVNode("",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(voiceList)[unref(t)],(b,x)=>(openBlock(),createElementBlock("option",{key:x,value:b},toDisplayString(b),9,_hoisted_31))),128))],32)])])):createCommentVNode("",!0)]),_:1})]),createBaseVNode("div",null,[createBaseVNode("div",_hoisted_32,[createBaseVNode("label",_hoisted_33,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[7]||(_[7]=b=>isRef(a)?a.value=b:null),checked:unref(a),"aria-checked":unref(a),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_34),[[vModelCheckbox,unref(a)]]),createBaseVNode("div",_hoisted_35,[createVNode(Transition,{name:"slide-away",mode:"out-in"},{default:withCtx(()=>[unref(a)?(openBlock(),createElementBlock("div",_hoisted_36)):(openBlock(),createElementBlock("div",_hoisted_37))]),_:1})])])])])]))}}),_hoisted_1$b={"mb-1":"","w-full":"","gap-2":""},_sfc_main$f=defineComponent({__name:"Header",setup(r){return(e,t)=>(openBlock(),createElementBlock("header",_hoisted_1$b,[t[0]||(t[0]=createBaseVNode("div",{flex:"~ 1","w-full":"","items-center":"","gap-2":"","px-2":"","text-nowrap":"","text-2xl":""},[createBaseVNode("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),createBaseVNode("div",{"font-cute":""},[createBaseVNode("span",null,"アイリ")])],-1)),createVNode(_sfc_main$g)]))}});var dist={},ortWeb_min={exports:{}};const backends={},backendsSortedByPriority=[],registerBackend=(r,e,t)=>{if(e&&typeof e.init=="function"&&typeof e.createSessionHandler=="function"){const n=backends[r];if(n===void 0)backends[r]={backend:e,priority:t};else{if(n.priority>t)return;if(n.priority===t&&n.backend!==e)throw new Error(`cannot register backend "${r}" using priority ${t}`)}if(t>=0){const i=backendsSortedByPriority.indexOf(r);i!==-1&&backendsSortedByPriority.splice(i,1);for(let a=0;a{const e=r.length===0?backendsSortedByPriority:r,t=[];for(const n of e){const i=backends[n];if(i){if(i.initialized)return i.backend;if(i.aborted)continue;const a=!!i.initPromise;try{return a||(i.initPromise=i.backend.init()),await i.initPromise,i.initialized=!0,i.backend}catch(l){a||t.push({name:n,err:l}),i.aborted=!0}finally{delete i.initPromise}}}throw new Error(`no available backend found. ERR: ${t.map(n=>`[${n.name}] ${n.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(e){if(e!==void 0){if(typeof e!="string"||["verbose","info","warning","error","fatal"].indexOf(e)===-1)throw new Error(`Unsupported logging level: ${e}`);this.logLevelInternal=e}}get logLevel(){return this.logLevelInternal}}const env$1=new EnvImpl,isBigInt64ArrayAvailable=typeof BigInt64Array<"u"&&typeof BigInt64Array.from=="function",isBigUint64ArrayAvailable=typeof BigUint64Array<"u"&&typeof BigUint64Array.from=="function",NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);isBigInt64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64",BigInt64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array,"int64"));isBigUint64ArrayAvailable&&(NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64",BigUint64Array),NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array,"uint64"));const calculateSize=r=>{let e=1;for(let t=0;t{const s=document.createElement("canvas"),o=s.getContext("2d");if(!e||!o)return m();const c=new Image;c.crossOrigin="Anonymous",c.src=e,c.onload=()=>{s.width=c.width,s.height=c.height,o.drawImage(c,0,0,s.width,s.height);const v=o.getImageData(0,0,s.width,s.height);if(t!==void 0){if(t.height!==void 0&&t.height!==s.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(d.height=s.height,t.width!==void 0&&t.width!==s.width)throw new Error("Image input config width doesn't match ImageBitmap width");d.width=s.width}else d.height=s.height,d.width=s.width;f(Bn.bufferToTensor(v.data,d))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(u!==void 0)return Bn.bufferToTensor(u,d);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(e){var t,n;const i=document.createElement("canvas").getContext("2d");let a;if(i!=null){const l=this.dims[3],u=this.dims[2],d=this.dims[1],f=e!==void 0&&e.format!==void 0?e.format:"RGB",m=e!==void 0&&((t=e.norm)===null||t===void 0?void 0:t.mean)!==void 0?e.norm.mean:255,s=e!==void 0&&((n=e.norm)===null||n===void 0?void 0:n.bias)!==void 0?e.norm.bias:0,o=u*l;if(e!==void 0){if(e.height!==void 0&&e.height!==u)throw new Error("Image output config height doesn't match tensor height");if(e.width!==void 0&&e.width!==l)throw new Error("Image output config width doesn't match tensor width");if(e.format!==void 0&&d===4&&e.format!=="RGBA"||d===3&&e.format!=="RGB"&&e.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const c=4;let v=0,y=1,_=2,b=3,x=0,w=o,S=o*2,T=-1;f==="RGBA"?(x=0,w=o,S=o*2,T=o*3):f==="RGB"?(x=0,w=o,S=o*2):f==="RBG"&&(x=0,S=o,w=o*2),a=i.createImageData(l,u);for(let E=0;E"u")throw new Error(`input '${f}' is missing in 'feeds'.`);if(l)for(const f of this.outputNames)i[f]=null;const u=await this.handler.run(e,i,a),d={};for(const f in u)Object.hasOwnProperty.call(u,f)&&(d[f]=new Tensor(u[f].type,u[f].data,u[f].dims));return d}static async create(e,t,n,i){let a,l={};if(typeof e=="string"){if(a=e,typeof t=="object"&&t!==null)l=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof Uint8Array){if(a=e,typeof t=="object"&&t!==null)l=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer){const s=e;let o=0,c=e.byteLength;if(typeof t=="object"&&t!==null)l=t;else if(typeof t=="number"){if(o=t,!Number.isSafeInteger(o))throw new RangeError("'byteOffset' must be an integer.");if(o<0||o>=s.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${s.byteLength}).`);if(c=e.byteLength-o,typeof n=="number"){if(c=n,!Number.isSafeInteger(c))throw new RangeError("'byteLength' must be an integer.");if(c<=0||o+c>s.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${s.byteLength-o}].`);if(typeof i=="object"&&i!==null)l=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else if(typeof n<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");a=new Uint8Array(s,o,c)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const d=(l.executionProviders||[]).map(s=>typeof s=="string"?s:s.name),m=await(await resolveBackend(d)).createSessionHandler(a,l);return new jr(m)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const InferenceSession=InferenceSession$1,lib$1=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession,Tensor,env:env$1,registerBackend},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(lib$1);/*! -* ONNX Runtime Web v1.14.0 -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the MIT License. -*/var hasRequiredOrtWeb_min;function requireOrtWeb_min(){return hasRequiredOrtWeb_min||(hasRequiredOrtWeb_min=1,function(module,exports){(function(r,e){module.exports=e(require$$0$1)})(self,__WEBPACK_EXTERNAL_MODULE__1670__=>(()=>{var __webpack_modules__={3474:(r,e,t)=>{var n,i=(n=(n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(a){function l(){return Y.buffer!=X&&Ie(Y.buffer),Z}function u(){return Y.buffer!=X&&Ie(Y.buffer),z}function d(){return Y.buffer!=X&&Ie(Y.buffer),_e}function f(){return Y.buffer!=X&&Ie(Y.buffer),fe}function m(){return Y.buffer!=X&&Ie(Y.buffer),We}var s,o,c;a=a||{},s||(s=a!==void 0?a:{}),s.ready=new Promise(function(V,J){o=V,c=J});var v,y,_,b,x,w,S=Object.assign({},s),T="./this.program",E=(V,J)=>{throw J},M=typeof window=="object",P=typeof importScripts=="function",A=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",C=s.ENVIRONMENT_IS_PTHREAD||!1,D="";function k(V){return s.locateFile?s.locateFile(V,D):D+V}if(A){let V;D=P?t(908).dirname(D)+"/":"//",w=()=>{x||(b=t(1384),x=t(908))},v=function(J,se){return w(),J=x.normalize(J),b.readFileSync(J,se?void 0:"utf8")},_=J=>((J=v(J,!0)).buffer||(J=new Uint8Array(J)),J),y=(J,se,we)=>{w(),J=x.normalize(J),b.readFile(J,function(Ve,Ze){Ve?we(Ve):se(Ze.buffer)})},1{if(Be())throw process.exitCode=J,se;se instanceof Pt||U("exiting due to exception: "+se),process.exit(J)},s.inspect=function(){return"[Emscripten Module object]"};try{V=t(9925)}catch(J){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),J}t.g.Worker=V.Worker}else(M||P)&&(P?D=self.location.href:typeof document<"u"&&document.currentScript&&(D=document.currentScript.src),n&&(D=n),D=D.indexOf("blob:")!==0?D.substr(0,D.replace(/[?#].*/,"").lastIndexOf("/")+1):"",A||(v=V=>{var J=new XMLHttpRequest;return J.open("GET",V,!1),J.send(null),J.responseText},P&&(_=V=>{var J=new XMLHttpRequest;return J.open("GET",V,!1),J.responseType="arraybuffer",J.send(null),new Uint8Array(J.response)}),y=(V,J,se)=>{var we=new XMLHttpRequest;we.open("GET",V,!0),we.responseType="arraybuffer",we.onload=()=>{we.status==200||we.status==0&&we.response?J(we.response):se()},we.onerror=se,we.send(null)}));A&&typeof performance>"u"&&(t.g.performance=t(6953).performance);var j=console.log.bind(console),I=console.warn.bind(console);A&&(w(),j=V=>b.writeSync(1,V+` -`),I=V=>b.writeSync(2,V+` -`));var W,L=s.print||j,U=s.printErr||I;Object.assign(s,S),S=null,s.thisProgram&&(T=s.thisProgram),s.quit&&(E=s.quit),s.wasmBinary&&(W=s.wasmBinary);var H=s.noExitRuntime||!1;typeof WebAssembly!="object"&&Xe("no native wasm support detected");var Y,B,X,Z,z,_e,fe,We,ft=!1,Te=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function G(V,J,se){var we=(J>>>=0)+se;for(se=J;V[se]&&!(se>=we);)++se;if(16(Ve=(240&Ve)==224?(15&Ve)<<12|Ze<<6|Mt:(7&Ve)<<18|Ze<<12|Mt<<6|63&V[J++])?we+=String.fromCharCode(Ve):(Ve-=65536,we+=String.fromCharCode(55296|Ve>>10,56320|1023&Ve))}}else we+=String.fromCharCode(Ve)}return we}function K(V,J){return(V>>>=0)?G(u(),V,J):""}function ue(V,J,se,we){if(!(0>>=0;we=se+we-1;for(var Ze=0;Ze=Mt&&(Mt=65536+((1023&Mt)<<10)|1023&V.charCodeAt(++Ze)),127>=Mt){if(se>=we)break;J[se++>>>0]=Mt}else{if(2047>=Mt){if(se+1>=we)break;J[se++>>>0]=192|Mt>>6}else{if(65535>=Mt){if(se+2>=we)break;J[se++>>>0]=224|Mt>>12}else{if(se+3>=we)break;J[se++>>>0]=240|Mt>>18,J[se++>>>0]=128|Mt>>12&63}J[se++>>>0]=128|Mt>>6&63}J[se++>>>0]=128|63&Mt}}return J[se>>>0]=0,se-Ve}function ke(V){for(var J=0,se=0;se=we?J++:2047>=we?J+=2:55296<=we&&57343>=we?(J+=4,++se):J+=3}return J}function Ie(V){X=V,s.HEAP8=Z=new Int8Array(V),s.HEAP16=new Int16Array(V),s.HEAP32=_e=new Int32Array(V),s.HEAPU8=z=new Uint8Array(V),s.HEAPU16=new Uint16Array(V),s.HEAPU32=fe=new Uint32Array(V),s.HEAPF32=new Float32Array(V),s.HEAPF64=We=new Float64Array(V)}C&&(X=s.buffer);var F=s.INITIAL_MEMORY||16777216;if(C)Y=s.wasmMemory,X=s.buffer;else if(s.wasmMemory)Y=s.wasmMemory;else if(!((Y=new WebAssembly.Memory({initial:F/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw U("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),A&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");Y&&(X=Y.buffer),F=X.byteLength,Ie(X);var ge,le=[],te=[],oe=[],pe=[];function Be(){return H||!1}function ze(){var V=s.preRun.shift();le.unshift(V)}var be,pt=0,Et=null;function Xe(V){throw C?postMessage({cmd:"onAbort",arg:V}):s.onAbort&&s.onAbort(V),U(V="Aborted("+V+")"),ft=!0,V=new WebAssembly.RuntimeError(V+". Build with -sASSERTIONS for more info."),c(V),V}function Ce(){return be.startsWith("data:application/octet-stream;base64,")}function bt(){var V=be;try{if(V==be&&W)return new Uint8Array(W);if(_)return _(V);throw"both async and sync fetching of the wasm failed"}catch(J){Xe(J)}}be="ort-wasm-threaded.wasm",Ce()||(be=k(be));var xt={};function Pt(V){this.name="ExitStatus",this.message="Program terminated with exit("+V+")",this.status=V}function Nt(V){(V=Rt.Vb[V])||Xe(),Rt.mc(V)}function Yt(V){var J=Rt.Cc();if(!J)return 6;Rt.ac.push(J),Rt.Vb[V.Ub]=J,J.Ub=V.Ub;var se={cmd:"run",start_routine:V.Ic,arg:V.zc,pthread_ptr:V.Ub};return J.$b=()=>{se.time=performance.now(),J.postMessage(se,V.Nc)},J.loaded&&(J.$b(),delete J.$b),0}function Vt(V){if(C)return Lt(1,1,V);Be()||(Rt.oc(),s.onExit&&s.onExit(V),ft=!0),E(V,new Pt(V))}function $t(V,J){if(!J&&C)throw wt(V),"unwind";Be()||C||(gr(),ee(oe),mr(0),er[1].length&&nr(1,10),er[2].length&&nr(2,10),Rt.oc()),Vt(V)}var Rt={Yb:[],ac:[],qc:[],Vb:{},fc:function(){C&&Rt.Ec()},Pc:function(){},Ec:function(){Rt.receiveObjectTransfer=Rt.Gc,Rt.threadInitTLS=Rt.pc,Rt.setExitStatus=Rt.nc,H=!1},nc:function(){},oc:function(){for(var V of Object.values(Rt.Vb))Rt.mc(V);for(V of Rt.Yb)V.terminate();Rt.Yb=[]},mc:function(V){var J=V.Ub;delete Rt.Vb[J],Rt.Yb.push(V),Rt.ac.splice(Rt.ac.indexOf(V),1),V.Ub=0,ir(J)},Gc:function(){},pc:function(){Rt.qc.forEach(V=>V())},Fc:function(V,J){V.onmessage=se=>{var we=(se=se.data).cmd;if(V.Ub&&(Rt.Bc=V.Ub),se.targetThread&&se.targetThread!=Wn()){var Ve=Rt.Vb[se.Qc];Ve?Ve.postMessage(se,se.transferList):U('Internal error! Worker sent a message "'+we+'" to target pthread '+se.targetThread+", but that thread no longer exists!")}else we==="processProxyingQueue"?Me(se.queue):we==="spawnThread"?Yt(se):we==="cleanupThread"?Nt(se.thread):we==="killThread"?(se=se.thread,we=Rt.Vb[se],delete Rt.Vb[se],we.terminate(),ir(se),Rt.ac.splice(Rt.ac.indexOf(we),1),we.Ub=0):we==="cancelThread"?Rt.Vb[se.thread].postMessage({cmd:"cancel"}):we==="loaded"?(V.loaded=!0,J&&J(V),V.$b&&(V.$b(),delete V.$b)):we==="print"?L("Thread "+se.threadId+": "+se.text):we==="printErr"?U("Thread "+se.threadId+": "+se.text):we==="alert"?alert("Thread "+se.threadId+": "+se.text):se.target==="setimmediate"?V.postMessage(se):we==="onAbort"?s.onAbort&&s.onAbort(se.arg):we&&U("worker sent an unknown command "+we);Rt.Bc=void 0},V.onerror=se=>{throw U("worker sent an error! "+se.filename+":"+se.lineno+": "+se.message),se},A&&(V.on("message",function(se){V.onmessage({data:se})}),V.on("error",function(se){V.onerror(se)}),V.on("detachedExit",function(){})),V.postMessage({cmd:"load",urlOrBlob:s.mainScriptUrlOrBlob||n,wasmMemory:Y,wasmModule:B})},yc:function(){var V=k("ort-wasm-threaded.worker.js");Rt.Yb.push(new Worker(V))},Cc:function(){return Rt.Yb.length==0&&(Rt.yc(),Rt.Fc(Rt.Yb[0])),Rt.Yb.pop()}};function ee(V){for(;0>2>>>0];V=d()[V+48>>2>>>0],Tr(J,J-V),Gt(J)};var Ct=[];function It(V){var J=Ct[V];return J||(V>=Ct.length&&(Ct.length=V+1),Ct[V]=J=ge.get(V)),J}s.invokeEntryPoint=function(V,J){V=It(V)(J),Be()?Rt.nc(V):wr(V)};var Dt,rn,tn=[],Ot=0,kt=0;function Bt(V){this.Zb=V,this.Sb=V-24,this.xc=function(J){f()[this.Sb+4>>2>>>0]=J},this.bc=function(){return f()[this.Sb+4>>2>>>0]},this.wc=function(J){f()[this.Sb+8>>2>>>0]=J},this.Dc=function(){return f()[this.Sb+8>>2>>>0]},this.rc=function(){d()[this.Sb>>2>>>0]=0},this.hc=function(J){J=J?1:0,l()[this.Sb+12>>0>>>0]=J},this.uc=function(){return l()[this.Sb+12>>0>>>0]!=0},this.ic=function(J){J=J?1:0,l()[this.Sb+13>>0>>>0]=J},this.kc=function(){return l()[this.Sb+13>>0>>>0]!=0},this.fc=function(J,se){this.cc(0),this.xc(J),this.wc(se),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(d(),this.Sb>>2,1)},this.Hc=function(){return Atomics.sub(d(),this.Sb>>2,1)===1},this.cc=function(J){f()[this.Sb+16>>2>>>0]=J},this.tc=function(){return f()[this.Sb+16>>2>>>0]},this.vc=function(){if(Sr(this.bc()))return f()[this.Zb>>2>>>0];var J=this.tc();return J!==0?J:this.Zb}}function ln(V){return hr(new Bt(V).Sb)}function en(V,J,se,we){return C?Lt(3,1,V,J,se,we):dn(V,J,se,we)}function dn(V,J,se,we){if(typeof SharedArrayBuffer>"u")return U("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var Ve=[];return C&&Ve.length===0?en(V,J,se,we):(V={Ic:se,Ub:V,zc:we,Nc:Ve},C?(V.Oc="spawnThread",postMessage(V,Ve),0):Yt(V))}function In(V,J,se){return C?Lt(4,1,V,J,se):0}function Rn(V,J){if(C)return Lt(5,1,V,J)}function hn(V,J){if(C)return Lt(6,1,V,J)}function Sn(V,J,se){if(C)return Lt(7,1,V,J,se)}function mn(V,J,se){return C?Lt(8,1,V,J,se):0}function Mn(V,J){if(C)return Lt(9,1,V,J)}function On(V,J,se){if(C)return Lt(10,1,V,J,se)}function kn(V,J,se,we){if(C)return Lt(11,1,V,J,se,we)}function vn(V,J,se,we){if(C)return Lt(12,1,V,J,se,we)}function yn(V,J,se,we){if(C)return Lt(13,1,V,J,se,we)}function Ln(V){if(C)return Lt(14,1,V)}function ie(V,J){if(C)return Lt(15,1,V,J)}function de(V,J,se){if(C)return Lt(16,1,V,J,se)}function Me(V){Atomics.store(d(),V>>2,1),Wn()&&br(V),Atomics.compareExchange(d(),V>>2,1,0)}function Ne(V){return f()[V>>>2]+4294967296*d()[V+4>>>2]}function Ge(V,J,se,we,Ve,Ze){return C?Lt(17,1,V,J,se,we,Ve,Ze):-52}function qe(V,J,se,we,Ve,Ze){if(C)return Lt(18,1,V,J,se,we,Ve,Ze)}function At(V){var J=ke(V)+1,se=rr(J);return se&&ue(V,l(),se,J),se}function Ft(V,J,se){function we(Kt){return(Kt=Kt.toTimeString().match(/\(([A-Za-z ]+)\)$/))?Kt[1]:"GMT"}if(C)return Lt(19,1,V,J,se);var Ve=new Date().getFullYear(),Ze=new Date(Ve,0,1),Mt=new Date(Ve,6,1);Ve=Ze.getTimezoneOffset();var Ut=Mt.getTimezoneOffset(),Xt=Math.max(Ve,Ut);d()[V>>2>>>0]=60*Xt,d()[J>>2>>>0]=+(Ve!=Ut),V=we(Ze),J=we(Mt),V=At(V),J=At(J),Ut>2>>>0]=V,f()[se+4>>2>>>0]=J):(f()[se>>2>>>0]=J,f()[se+4>>2>>>0]=V)}function Lt(V,J){var se=arguments.length-2,we=arguments;return ce(()=>{for(var Ve=or(8*se),Ze=Ve>>3,Mt=0;Mt>>0]=Ut}return _r(V,se,Ve,J)})}s.executeNotifiedProxyingQueue=Me,rn=A?()=>{var V=process.hrtime();return 1e3*V[0]+V[1]/1e6}:C?()=>performance.now()-s.__performance_now_clock_drift:()=>performance.now();var jt,Jt=[],cn={};function un(){if(!jt){var V,J={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:T||"./this.program"};for(V in cn)cn[V]===void 0?delete J[V]:J[V]=cn[V];var se=[];for(V in J)se.push(V+"="+J[V]);jt=se}return jt}function Qe(V,J){if(C)return Lt(20,1,V,J);var se=0;return un().forEach(function(we,Ve){var Ze=J+se;for(Ve=f()[V+4*Ve>>2>>>0]=Ze,Ze=0;Ze>0>>>0]=we.charCodeAt(Ze);l()[Ve>>0>>>0]=0,se+=we.length+1}),0}function Zt(V,J){if(C)return Lt(21,1,V,J);var se=un();f()[V>>2>>>0]=se.length;var we=0;return se.forEach(function(Ve){we+=Ve.length+1}),f()[J>>2>>>0]=we,0}function nn(V){return C?Lt(22,1,V):52}function xn(V,J,se,we){return C?Lt(23,1,V,J,se,we):52}function Nn(V,J,se,we,Ve){return C?Lt(24,1,V,J,se,we,Ve):70}var er=[null,[],[]];function nr(V,J){var se=er[V];J===0||J===10?((V===1?L:U)(G(se,0)),se.length=0):se.push(J)}function sr(V,J,se,we){if(C)return Lt(25,1,V,J,se,we);for(var Ve=0,Ze=0;Ze>2>>>0],Ut=f()[J+4>>2>>>0];J+=8;for(var Xt=0;Xt>>0]);Ve+=Ut}return f()[we>>2>>>0]=Ve,0}var pn=0;function Hn(V){return V%4==0&&(V%100!=0||V%400==0)}var lr=[31,29,31,30,31,30,31,31,30,31,30,31],ur=[31,28,31,30,31,30,31,31,30,31,30,31];function cr(V,J,se,we){function Ve(Je,Qt,an){for(Je=typeof Je=="number"?Je.toString():Je||"";Je.lengthUn?-1:0Fn-Je.getDate())){Je.setDate(Je.getDate()+Qt);break}Qt-=Fn-Je.getDate()+1,Je.setDate(1),11>an?Je.setMonth(an+1):(Je.setMonth(0),Je.setFullYear(Je.getFullYear()+1))}return an=new Date(Je.getFullYear()+1,0,4),Qt=Ut(new Date(Je.getFullYear(),0,4)),an=Ut(an),0>=Mt(Qt,Je)?0>=Mt(an,Je)?Je.getFullYear()+1:Je.getFullYear():Je.getFullYear()-1}var Kt=d()[we+40>>2>>>0];for(var sn in we={Lc:d()[we>>2>>>0],Kc:d()[we+4>>2>>>0],dc:d()[we+8>>2>>>0],jc:d()[we+12>>2>>>0],ec:d()[we+16>>2>>>0],Xb:d()[we+20>>2>>>0],Tb:d()[we+24>>2>>>0],Wb:d()[we+28>>2>>>0],Rc:d()[we+32>>2>>>0],Jc:d()[we+36>>2>>>0],Mc:Kt?K(Kt):""},se=K(se),Kt={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})se=se.replace(new RegExp(sn,"g"),Kt[sn]);var Dn="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Tn="January February March April May June July August September October November December".split(" ");for(sn in Kt={"%a":function(Je){return Dn[Je.Tb].substring(0,3)},"%A":function(Je){return Dn[Je.Tb]},"%b":function(Je){return Tn[Je.ec].substring(0,3)},"%B":function(Je){return Tn[Je.ec]},"%C":function(Je){return Ze((Je.Xb+1900)/100|0,2)},"%d":function(Je){return Ze(Je.jc,2)},"%e":function(Je){return Ve(Je.jc,2," ")},"%g":function(Je){return Xt(Je).toString().substring(2)},"%G":function(Je){return Xt(Je)},"%H":function(Je){return Ze(Je.dc,2)},"%I":function(Je){return(Je=Je.dc)==0?Je=12:12Je.dc?"AM":"PM"},"%S":function(Je){return Ze(Je.Lc,2)},"%t":function(){return" "},"%u":function(Je){return Je.Tb||7},"%U":function(Je){return Ze(Math.floor((Je.Wb+7-Je.Tb)/7),2)},"%V":function(Je){var Qt=Math.floor((Je.Wb+7-(Je.Tb+6)%7)/7);if(2>=(Je.Tb+371-Je.Wb-2)%7&&Qt++,Qt)Qt==53&&((an=(Je.Tb+371-Je.Wb)%7)==4||an==3&&Hn(Je.Xb)||(Qt=1));else{Qt=52;var an=(Je.Tb+7-Je.Wb-1)%7;(an==4||an==5&&Hn(Je.Xb%400-1))&&Qt++}return Ze(Qt,2)},"%w":function(Je){return Je.Tb},"%W":function(Je){return Ze(Math.floor((Je.Wb+7-(Je.Tb+6)%7)/7),2)},"%y":function(Je){return(Je.Xb+1900).toString().substring(2)},"%Y":function(Je){return Je.Xb+1900},"%z":function(Je){var Qt=0<=(Je=Je.Jc);return Je=Math.abs(Je)/60,(Qt?"+":"-")+("0000"+(Je/60*100+Je%60)).slice(-4)},"%Z":function(Je){return Je.Mc},"%%":function(){return"%"}},se=se.replace(/%%/g,"\0\0"),Kt)se.includes(sn)&&(se=se.replace(new RegExp(sn,"g"),Kt[sn](we)));return sn=function(Je){var Qt=Array(ke(Je)+1);return ue(Je,Qt,0,Qt.length),Qt}(se=se.replace(/\0\0/g,"%")),sn.length>J?0:(function(Je,Qt){l().set(Je,Qt>>>0)}(sn,V),sn.length-1)}Rt.fc();var ei=[null,Vt,wt,en,In,Rn,hn,Sn,mn,Mn,On,kn,vn,yn,Ln,ie,de,Ge,qe,Ft,Qe,Zt,nn,xn,Nn,sr],ti={b:function(V){return rr(V+24)+24},n:function(V){return(V=new Bt(V)).uc()||(V.hc(!0),Ot--),V.ic(!1),tn.push(V),V.sc(),V.vc()},ma:function(V){throw U("Unexpected exception thrown, this is not properly supported - aborting"),ft=!0,V},x:function(){qt(0);var V=tn.pop();if(V.Hc()&&!V.kc()){var J=V.Dc();J&&It(J)(V.Zb),ln(V.Zb)}kt=0},e:function(){var V=kt;if(!V)return pn=0;var J=new Bt(V);J.cc(V);var se=J.bc();if(!se)return pn=0,V;for(var we=Array.prototype.slice.call(arguments),Ve=0;VeMe(we));else if(C)postMessage({targetThread:V,cmd:"processProxyingQueue",queue:we});else{if(!(V=Rt.Vb[V]))return;V.postMessage({cmd:"processProxyingQueue",queue:we})}return 1},Ea:function(){return-1},Pa:function(V,J){V=new Date(1e3*Ne(V)),d()[J>>2>>>0]=V.getUTCSeconds(),d()[J+4>>2>>>0]=V.getUTCMinutes(),d()[J+8>>2>>>0]=V.getUTCHours(),d()[J+12>>2>>>0]=V.getUTCDate(),d()[J+16>>2>>>0]=V.getUTCMonth(),d()[J+20>>2>>>0]=V.getUTCFullYear()-1900,d()[J+24>>2>>>0]=V.getUTCDay(),V=(V.getTime()-Date.UTC(V.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,d()[J+28>>2>>>0]=V},Qa:function(V,J){V=new Date(1e3*Ne(V)),d()[J>>2>>>0]=V.getSeconds(),d()[J+4>>2>>>0]=V.getMinutes(),d()[J+8>>2>>>0]=V.getHours(),d()[J+12>>2>>>0]=V.getDate(),d()[J+16>>2>>>0]=V.getMonth(),d()[J+20>>2>>>0]=V.getFullYear()-1900,d()[J+24>>2>>>0]=V.getDay();var se=new Date(V.getFullYear(),0,1),we=(V.getTime()-se.getTime())/864e5|0;d()[J+28>>2>>>0]=we,d()[J+36>>2>>>0]=-60*V.getTimezoneOffset(),we=new Date(V.getFullYear(),6,1).getTimezoneOffset(),V=0|(we!=(se=se.getTimezoneOffset())&&V.getTimezoneOffset()==Math.min(se,we)),d()[J+32>>2>>>0]=V},Ra:function(V){var J=new Date(d()[V+20>>2>>>0]+1900,d()[V+16>>2>>>0],d()[V+12>>2>>>0],d()[V+8>>2>>>0],d()[V+4>>2>>>0],d()[V>>2>>>0],0),se=d()[V+32>>2>>>0],we=J.getTimezoneOffset(),Ve=new Date(J.getFullYear(),0,1),Ze=new Date(J.getFullYear(),6,1).getTimezoneOffset(),Mt=Ve.getTimezoneOffset(),Ut=Math.min(Mt,Ze);return 0>se?d()[V+32>>2>>>0]=+(Ze!=Mt&&Ut==we):0>2>>>0]=J.getDay(),se=(J.getTime()-Ve.getTime())/864e5|0,d()[V+28>>2>>>0]=se,d()[V>>2>>>0]=J.getSeconds(),d()[V+4>>2>>>0]=J.getMinutes(),d()[V+8>>2>>>0]=J.getHours(),d()[V+12>>2>>>0]=J.getDate(),d()[V+16>>2>>>0]=J.getMonth(),J.getTime()/1e3|0},Aa:Ge,Ba:qe,Sa:function V(J,se,we){V.Ac||(V.Ac=!0,Ft(J,se,we))},y:function(){Xe("")},U:function(){if(!A&&!P){var V="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";Dt||(Dt={}),Dt[V]||(Dt[V]=1,A&&(V="warning: "+V),U(V))}},ra:function(){return 4294901760},B:rn,Ia:function(V,J,se){u().copyWithin(V>>>0,J>>>0,J+se>>>0)},F:function(){return A?t(3993).cpus().length:navigator.hardwareConcurrency},Da:function(V,J,se){Jt.length=J,se>>=3;for(var we=0;we>>0];return(0>V?xt[-V-1]:ei[V]).apply(null,Jt)},qa:function(V){var J=u().length;if((V>>>=0)<=J||4294901760=se;se*=2){var we=J*(1+.2/se);we=Math.min(we,V+100663296);var Ve=Math;we=Math.max(V,we),Ve=Ve.min.call(Ve,4294901760,we+(65536-we%65536)%65536);e:{try{Y.grow(Ve-X.byteLength+65535>>>16),Ie(Y.buffer);var Ze=1;break e}catch{}Ze=void 0}if(Ze)return!0}return!1},Na:function(){throw"unwind"},Ga:Qe,Ha:Zt,J:$t,I:nn,S:xn,ga:Nn,R:sr,d:function(){return pn},na:function V(J,se){V.lc||(V.lc=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var Ve=new Uint8Array(1);return()=>(crypto.getRandomValues(Ve),Ve[0])}if(A)try{var Ze=t(Object(function(){var Mt=new Error("Cannot find module 'crypto'");throw Mt.code="MODULE_NOT_FOUND",Mt}()));return()=>Ze.randomBytes(1)[0]}catch{}return()=>Xe("randomDevice")}());for(var we=0;we>0>>>0]=V.lc();return 0},ia:function(V,J,se){var we=Ht();try{return It(V)(J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},ja:function(V,J,se){var we=Ht();try{return It(V)(J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},K:function(V){var J=Ht();try{return It(V)()}catch(se){if(Gt(J),se!==se+0)throw se;qt(1,0)}},f:function(V,J){var se=Ht();try{return It(V)(J)}catch(we){if(Gt(se),we!==we+0)throw we;qt(1,0)}},P:function(V,J,se){var we=Ht();try{return It(V)(J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},Q:function(V,J,se){var we=Ht();try{return It(V)(J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},k:function(V,J,se){var we=Ht();try{return It(V)(J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},p:function(V,J,se,we){var Ve=Ht();try{return It(V)(J,se,we)}catch(Ze){if(Gt(Ve),Ze!==Ze+0)throw Ze;qt(1,0)}},q:function(V,J,se,we,Ve){var Ze=Ht();try{return It(V)(J,se,we,Ve)}catch(Mt){if(Gt(Ze),Mt!==Mt+0)throw Mt;qt(1,0)}},N:function(V,J,se,we,Ve,Ze){var Mt=Ht();try{return It(V)(J,se,we,Ve,Ze)}catch(Ut){if(Gt(Mt),Ut!==Ut+0)throw Ut;qt(1,0)}},s:function(V,J,se,we,Ve,Ze){var Mt=Ht();try{return It(V)(J,se,we,Ve,Ze)}catch(Ut){if(Gt(Mt),Ut!==Ut+0)throw Ut;qt(1,0)}},w:function(V,J,se,we,Ve,Ze,Mt){var Ut=Ht();try{return It(V)(J,se,we,Ve,Ze,Mt)}catch(Xt){if(Gt(Ut),Xt!==Xt+0)throw Xt;qt(1,0)}},L:function(V,J,se,we,Ve,Ze,Mt,Ut){var Xt=Ht();try{return It(V)(J,se,we,Ve,Ze,Mt,Ut)}catch(Kt){if(Gt(Xt),Kt!==Kt+0)throw Kt;qt(1,0)}},E:function(V,J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn,Dn){var Tn=Ht();try{return It(V)(J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn,Dn)}catch(Je){if(Gt(Tn),Je!==Je+0)throw Je;qt(1,0)}},aa:function(V,J,se,we,Ve,Ze,Mt,Ut){var Xt=Ht();try{return Nr(V,J,se,we,Ve,Ze,Mt,Ut)}catch(Kt){if(Gt(Xt),Kt!==Kt+0)throw Kt;qt(1,0)}},_:function(V,J,se,we,Ve,Ze,Mt){var Ut=Ht();try{return Ar(V,J,se,we,Ve,Ze,Mt)}catch(Xt){if(Gt(Ut),Xt!==Xt+0)throw Xt;qt(1,0)}},Z:function(V,J,se,we,Ve){var Ze=Ht();try{return Ur(V,J,se,we,Ve)}catch(Mt){if(Gt(Ze),Mt!==Mt+0)throw Mt;qt(1,0)}},ca:function(V,J,se,we){var Ve=Ht();try{return Ir(V,J,se,we)}catch(Ze){if(Gt(Ve),Ze!==Ze+0)throw Ze;qt(1,0)}},$:function(V){var J=Ht();try{return Er(V)}catch(se){if(Gt(J),se!==se+0)throw se;qt(1,0)}},ba:function(V,J){var se=Ht();try{return Dr(V,J)}catch(we){if(Gt(se),we!==we+0)throw we;qt(1,0)}},Y:function(V,J,se){var we=Ht();try{return Mr(V,J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},g:function(V){var J=Ht();try{It(V)()}catch(se){if(Gt(J),se!==se+0)throw se;qt(1,0)}},r:function(V,J){var se=Ht();try{It(V)(J)}catch(we){if(Gt(se),we!==we+0)throw we;qt(1,0)}},i:function(V,J,se){var we=Ht();try{It(V)(J,se)}catch(Ve){if(Gt(we),Ve!==Ve+0)throw Ve;qt(1,0)}},ha:function(V,J,se,we){var Ve=Ht();try{It(V)(J,se,we)}catch(Ze){if(Gt(Ve),Ze!==Ze+0)throw Ze;qt(1,0)}},m:function(V,J,se,we){var Ve=Ht();try{It(V)(J,se,we)}catch(Ze){if(Gt(Ve),Ze!==Ze+0)throw Ze;qt(1,0)}},v:function(V,J,se,we,Ve){var Ze=Ht();try{It(V)(J,se,we,Ve)}catch(Mt){if(Gt(Ze),Mt!==Mt+0)throw Mt;qt(1,0)}},u:function(V,J,se,we,Ve,Ze){var Mt=Ht();try{It(V)(J,se,we,Ve,Ze)}catch(Ut){if(Gt(Mt),Ut!==Ut+0)throw Ut;qt(1,0)}},O:function(V,J,se,we,Ve,Ze,Mt){var Ut=Ht();try{It(V)(J,se,we,Ve,Ze,Mt)}catch(Xt){if(Gt(Ut),Xt!==Xt+0)throw Xt;qt(1,0)}},A:function(V,J,se,we,Ve,Ze,Mt,Ut){var Xt=Ht();try{It(V)(J,se,we,Ve,Ze,Mt,Ut)}catch(Kt){if(Gt(Xt),Kt!==Kt+0)throw Kt;qt(1,0)}},ka:function(V,J,se,we,Ve,Ze,Mt,Ut,Xt){var Kt=Ht();try{It(V)(J,se,we,Ve,Ze,Mt,Ut,Xt)}catch(sn){if(Gt(Kt),sn!==sn+0)throw sn;qt(1,0)}},C:function(V,J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn){var Dn=Ht();try{It(V)(J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn)}catch(Tn){if(Gt(Dn),Tn!==Tn+0)throw Tn;qt(1,0)}},D:function(V,J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn,Dn,Tn,Je,Qt,an){var Fn=Ht();try{It(V)(J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn,Dn,Tn,Je,Qt,an)}catch(Un){if(Gt(Fn),Un!==Un+0)throw Un;qt(1,0)}},fa:function(V,J,se,we,Ve,Ze,Mt,Ut){var Xt=Ht();try{Pr(V,J,se,we,Ve,Ze,Mt,Ut)}catch(Kt){if(Gt(Xt),Kt!==Kt+0)throw Kt;qt(1,0)}},da:function(V,J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn,Dn){var Tn=Ht();try{Or(V,J,se,we,Ve,Ze,Mt,Ut,Xt,Kt,sn,Dn)}catch(Je){if(Gt(Tn),Je!==Je+0)throw Je;qt(1,0)}},ea:function(V,J,se,we,Ve,Ze){var Mt=Ht();try{Cr(V,J,se,we,Ve,Ze)}catch(Ut){if(Gt(Mt),Ut!==Ut+0)throw Ut;qt(1,0)}},o:function(V){return V},a:Y||s.wasmMemory,G:function(V){pn=V},la:cr,z:function(V,J,se,we){return cr(V,J,se,we)}};(function(){function V(Ve,Ze){s.asm=Ve.exports,Rt.qc.push(s.asm.sb),ge=s.asm.ub,te.unshift(s.asm.Va),B=Ze,C||(pt--,s.monitorRunDependencies&&s.monitorRunDependencies(pt),pt==0&&Et&&(Ve=Et,Et=null,Ve()))}function J(Ve){V(Ve.instance,Ve.module)}function se(Ve){return function(){if(!W&&(M||P)){if(typeof fetch=="function"&&!be.startsWith("file://"))return fetch(be,{credentials:"same-origin"}).then(function(Ze){if(!Ze.ok)throw"failed to load wasm binary file at '"+be+"'";return Ze.arrayBuffer()}).catch(function(){return bt()});if(y)return new Promise(function(Ze,Mt){y(be,function(Ut){Ze(new Uint8Array(Ut))},Mt)})}return Promise.resolve().then(function(){return bt()})}().then(function(Ze){return WebAssembly.instantiate(Ze,we)}).then(function(Ze){return Ze}).then(Ve,function(Ze){U("failed to asynchronously prepare wasm: "+Ze),Xe(Ze)})}var we={a:ti};if(C||(pt++,s.monitorRunDependencies&&s.monitorRunDependencies(pt)),s.instantiateWasm)try{return s.instantiateWasm(we,V)}catch(Ve){return U("Module.instantiateWasm callback failed with error: "+Ve),!1}(W||typeof WebAssembly.instantiateStreaming!="function"||Ce()||be.startsWith("file://")||A||typeof fetch!="function"?se(J):fetch(be,{credentials:"same-origin"}).then(function(Ve){return WebAssembly.instantiateStreaming(Ve,we).then(J,function(Ze){return U("wasm streaming compile failed: "+Ze),U("falling back to ArrayBuffer instantiation"),se(J)})})).catch(c)})(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.Va).apply(null,arguments)},s._OrtInit=function(){return(s._OrtInit=s.asm.Wa).apply(null,arguments)},s._OrtCreateSessionOptions=function(){return(s._OrtCreateSessionOptions=s.asm.Xa).apply(null,arguments)},s._OrtAppendExecutionProvider=function(){return(s._OrtAppendExecutionProvider=s.asm.Ya).apply(null,arguments)},s._OrtAddSessionConfigEntry=function(){return(s._OrtAddSessionConfigEntry=s.asm.Za).apply(null,arguments)},s._OrtReleaseSessionOptions=function(){return(s._OrtReleaseSessionOptions=s.asm._a).apply(null,arguments)},s._OrtCreateSession=function(){return(s._OrtCreateSession=s.asm.$a).apply(null,arguments)},s._OrtReleaseSession=function(){return(s._OrtReleaseSession=s.asm.ab).apply(null,arguments)},s._OrtGetInputCount=function(){return(s._OrtGetInputCount=s.asm.bb).apply(null,arguments)},s._OrtGetOutputCount=function(){return(s._OrtGetOutputCount=s.asm.cb).apply(null,arguments)},s._OrtGetInputName=function(){return(s._OrtGetInputName=s.asm.db).apply(null,arguments)},s._OrtGetOutputName=function(){return(s._OrtGetOutputName=s.asm.eb).apply(null,arguments)},s._OrtFree=function(){return(s._OrtFree=s.asm.fb).apply(null,arguments)},s._OrtCreateTensor=function(){return(s._OrtCreateTensor=s.asm.gb).apply(null,arguments)},s._OrtGetTensorData=function(){return(s._OrtGetTensorData=s.asm.hb).apply(null,arguments)},s._OrtReleaseTensor=function(){return(s._OrtReleaseTensor=s.asm.ib).apply(null,arguments)},s._OrtCreateRunOptions=function(){return(s._OrtCreateRunOptions=s.asm.jb).apply(null,arguments)},s._OrtAddRunConfigEntry=function(){return(s._OrtAddRunConfigEntry=s.asm.kb).apply(null,arguments)},s._OrtReleaseRunOptions=function(){return(s._OrtReleaseRunOptions=s.asm.lb).apply(null,arguments)},s._OrtRun=function(){return(s._OrtRun=s.asm.mb).apply(null,arguments)},s._OrtEndProfiling=function(){return(s._OrtEndProfiling=s.asm.nb).apply(null,arguments)};var Wn=s._pthread_self=function(){return(Wn=s._pthread_self=s.asm.ob).apply(null,arguments)},rr=s._malloc=function(){return(rr=s._malloc=s.asm.pb).apply(null,arguments)},hr=s._free=function(){return(hr=s._free=s.asm.qb).apply(null,arguments)},mr=s._fflush=function(){return(mr=s._fflush=s.asm.rb).apply(null,arguments)};s.__emscripten_tls_init=function(){return(s.__emscripten_tls_init=s.asm.sb).apply(null,arguments)};var gr=s.___funcs_on_exit=function(){return(gr=s.___funcs_on_exit=s.asm.tb).apply(null,arguments)},vr=s.__emscripten_thread_init=function(){return(vr=s.__emscripten_thread_init=s.asm.vb).apply(null,arguments)};s.__emscripten_thread_crashed=function(){return(s.__emscripten_thread_crashed=s.asm.wb).apply(null,arguments)};var qn,_r=s._emscripten_run_in_main_runtime_thread_js=function(){return(_r=s._emscripten_run_in_main_runtime_thread_js=s.asm.xb).apply(null,arguments)},br=s.__emscripten_proxy_execute_task_queue=function(){return(br=s.__emscripten_proxy_execute_task_queue=s.asm.yb).apply(null,arguments)},ir=s.__emscripten_thread_free_data=function(){return(ir=s.__emscripten_thread_free_data=s.asm.zb).apply(null,arguments)},wr=s.__emscripten_thread_exit=function(){return(wr=s.__emscripten_thread_exit=s.asm.Ab).apply(null,arguments)},qt=s._setThrew=function(){return(qt=s._setThrew=s.asm.Bb).apply(null,arguments)},Tr=s._emscripten_stack_set_limits=function(){return(Tr=s._emscripten_stack_set_limits=s.asm.Cb).apply(null,arguments)},Ht=s.stackSave=function(){return(Ht=s.stackSave=s.asm.Db).apply(null,arguments)},Gt=s.stackRestore=function(){return(Gt=s.stackRestore=s.asm.Eb).apply(null,arguments)},or=s.stackAlloc=function(){return(or=s.stackAlloc=s.asm.Fb).apply(null,arguments)},Yn=s.___cxa_can_catch=function(){return(Yn=s.___cxa_can_catch=s.asm.Gb).apply(null,arguments)},Sr=s.___cxa_is_pointer_type=function(){return(Sr=s.___cxa_is_pointer_type=s.asm.Hb).apply(null,arguments)},Er=s.dynCall_j=function(){return(Er=s.dynCall_j=s.asm.Ib).apply(null,arguments)},Ar=s.dynCall_iiiiij=function(){return(Ar=s.dynCall_iiiiij=s.asm.Jb).apply(null,arguments)},Mr=s.dynCall_jii=function(){return(Mr=s.dynCall_jii=s.asm.Kb).apply(null,arguments)},Pr=s.dynCall_viiiiij=function(){return(Pr=s.dynCall_viiiiij=s.asm.Lb).apply(null,arguments)},Cr=s.dynCall_vjji=function(){return(Cr=s.dynCall_vjji=s.asm.Mb).apply(null,arguments)},Or=s.dynCall_viiijjjii=function(){return(Or=s.dynCall_viiijjjii=s.asm.Nb).apply(null,arguments)},Ir=s.dynCall_iij=function(){return(Ir=s.dynCall_iij=s.asm.Ob).apply(null,arguments)},Dr=s.dynCall_ji=function(){return(Dr=s.dynCall_ji=s.asm.Pb).apply(null,arguments)},Nr=s.dynCall_iiiiiij=function(){return(Nr=s.dynCall_iiiiiij=s.asm.Qb).apply(null,arguments)},Ur=s.dynCall_iiij=function(){return(Ur=s.dynCall_iiij=s.asm.Rb).apply(null,arguments)};function $r(){function V(){if(!qn&&(qn=!0,s.calledRun=!0,!ft)&&(C||ee(te),o(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),!C)){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var J=s.postRun.shift();pe.unshift(J)}ee(pe)}}if(!(0{var n,i=(n=(n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(a){var l,u,d;a=a||{},l||(l=a!==void 0?a:{}),l.ready=new Promise(function(ie,de){u=ie,d=de});var f,m,s,o,c,v,y=Object.assign({},l),_="./this.program",b=(ie,de)=>{throw de},x=typeof window=="object",w=typeof importScripts=="function",S=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",T="";S?(T=w?t(908).dirname(T)+"/":"//",v=()=>{c||(o=t(1384),c=t(908))},f=function(ie,de){return v(),ie=c.normalize(ie),o.readFileSync(ie,de?void 0:"utf8")},s=ie=>((ie=f(ie,!0)).buffer||(ie=new Uint8Array(ie)),ie),m=(ie,de,Me)=>{v(),ie=c.normalize(ie),o.readFile(ie,function(Ne,Ge){Ne?Me(Ne):de(Ge.buffer)})},1{if(A||0{var de=new XMLHttpRequest;return de.open("GET",ie,!1),de.send(null),de.responseText},w&&(s=ie=>{var de=new XMLHttpRequest;return de.open("GET",ie,!1),de.responseType="arraybuffer",de.send(null),new Uint8Array(de.response)}),m=(ie,de,Me)=>{var Ne=new XMLHttpRequest;Ne.open("GET",ie,!0),Ne.responseType="arraybuffer",Ne.onload=()=>{Ne.status==200||Ne.status==0&&Ne.response?de(Ne.response):Me()},Ne.onerror=Me,Ne.send(null)});var E,M=l.print||console.log.bind(console),P=l.printErr||console.warn.bind(console);Object.assign(l,y),y=null,l.thisProgram&&(_=l.thisProgram),l.quit&&(b=l.quit),l.wasmBinary&&(E=l.wasmBinary);var A=l.noExitRuntime||!1;typeof WebAssembly!="object"&&Ie("no native wasm support detected");var C,D,k,j,I,W,L=!1,U=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function H(ie,de,Me){var Ne=(de>>>=0)+Me;for(Me=de;ie[Me]&&!(Me>=Ne);)++Me;if(16(Ge=(240&Ge)==224?(15&Ge)<<12|qe<<6|At:(7&Ge)<<18|qe<<12|At<<6|63&ie[de++])?Ne+=String.fromCharCode(Ge):(Ge-=65536,Ne+=String.fromCharCode(55296|Ge>>10,56320|1023&Ge))}}else Ne+=String.fromCharCode(Ge)}return Ne}function Y(ie,de){return(ie>>>=0)?H(j,ie,de):""}function B(ie,de,Me,Ne){if(!(0>>=0;Ne=Me+Ne-1;for(var qe=0;qe=At&&(At=65536+((1023&At)<<10)|1023&ie.charCodeAt(++qe)),127>=At){if(Me>=Ne)break;de[Me++>>>0]=At}else{if(2047>=At){if(Me+1>=Ne)break;de[Me++>>>0]=192|At>>6}else{if(65535>=At){if(Me+2>=Ne)break;de[Me++>>>0]=224|At>>12}else{if(Me+3>=Ne)break;de[Me++>>>0]=240|At>>18,de[Me++>>>0]=128|At>>12&63}de[Me++>>>0]=128|At>>6&63}de[Me++>>>0]=128|63&At}}return de[Me>>>0]=0,Me-Ge}function X(ie){for(var de=0,Me=0;Me=Ne?de++:2047>=Ne?de+=2:55296<=Ne&&57343>=Ne?(de+=4,++Me):de+=3}return de}function Z(){var ie=C.buffer;D=ie,l.HEAP8=k=new Int8Array(ie),l.HEAP16=new Int16Array(ie),l.HEAP32=I=new Int32Array(ie),l.HEAPU8=j=new Uint8Array(ie),l.HEAPU16=new Uint16Array(ie),l.HEAPU32=W=new Uint32Array(ie),l.HEAPF32=new Float32Array(ie),l.HEAPF64=new Float64Array(ie)}var z,_e=[],fe=[],We=[],ft=[],Te=0;function G(){var ie=l.preRun.shift();_e.unshift(ie)}var K,ue=0,ke=null;function Ie(ie){throw l.onAbort&&l.onAbort(ie),P(ie="Aborted("+ie+")"),L=!0,ie=new WebAssembly.RuntimeError(ie+". Build with -sASSERTIONS for more info."),d(ie),ie}function F(){return K.startsWith("data:application/octet-stream;base64,")}if(K="ort-wasm.wasm",!F()){var ge=K;K=l.locateFile?l.locateFile(ge,T):T+ge}function le(){var ie=K;try{if(ie==K&&E)return new Uint8Array(E);if(s)return s(ie);throw"both async and sync fetching of the wasm failed"}catch(de){Ie(de)}}function te(ie){this.name="ExitStatus",this.message="Program terminated with exit("+ie+")",this.status=ie}function oe(ie){for(;0>2>>>0]=de},this.Eb=function(){return W[this.zb+4>>2>>>0]},this.Sb=function(de){W[this.zb+8>>2>>>0]=de},this.Wb=function(){return W[this.zb+8>>2>>>0]},this.Tb=function(){I[this.zb>>2>>>0]=0},this.Ib=function(de){k[this.zb+12>>0>>>0]=de?1:0},this.Pb=function(){return k[this.zb+12>>0>>>0]!=0},this.Jb=function(de){k[this.zb+13>>0>>>0]=de?1:0},this.Lb=function(){return k[this.zb+13>>0>>>0]!=0},this.Rb=function(de,Me){this.Fb(0),this.Ub(de),this.Sb(Me),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){I[this.zb>>2>>>0]+=1},this.Xb=function(){var de=I[this.zb>>2>>>0];return I[this.zb>>2>>>0]=de-1,de===1},this.Fb=function(de){W[this.zb+16>>2>>>0]=de},this.Ob=function(){return W[this.zb+16>>2>>>0]},this.Qb=function(){if(dn(this.Eb()))return W[this.Db>>2>>>0];var de=this.Ob();return de!==0?de:this.Db}}function pt(ie){return Dt(new be(ie).zb)}var Et=[];function Xe(ie){var de=Et[ie];return de||(ie>=Et.length&&(Et.length=ie+1),Et[ie]=de=z.get(ie)),de}function Ce(ie){var de=X(ie)+1,Me=It(de);return Me&&B(ie,k,Me,de),Me}var bt={};function xt(){if(!Pt){var ie,de={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:_||"./this.program"};for(ie in bt)bt[ie]===void 0?delete de[ie]:de[ie]=bt[ie];var Me=[];for(ie in de)Me.push(ie+"="+de[ie]);Pt=Me}return Pt}var Pt,Nt=[null,[],[]];function Yt(ie,de){var Me=Nt[ie];de===0||de===10?((ie===1?M:P)(H(Me,0)),Me.length=0):Me.push(de)}var Vt=0;function $t(ie){return ie%4==0&&(ie%100!=0||ie%400==0)}var Rt=[31,29,31,30,31,30,31,31,30,31,30,31],ee=[31,28,31,30,31,30,31,31,30,31,30,31];function ce(ie,de,Me,Ne){function Ge(Qe,Zt,nn){for(Qe=typeof Qe=="number"?Qe.toString():Qe||"";Qe.lengthNn?-1:0xn-Qe.getDate())){Qe.setDate(Qe.getDate()+Zt);break}Zt-=xn-Qe.getDate()+1,Qe.setDate(1),11>nn?Qe.setMonth(nn+1):(Qe.setMonth(0),Qe.setFullYear(Qe.getFullYear()+1))}return nn=new Date(Qe.getFullYear()+1,0,4),Zt=Ft(new Date(Qe.getFullYear(),0,4)),nn=Ft(nn),0>=At(Zt,Qe)?0>=At(nn,Qe)?Qe.getFullYear()+1:Qe.getFullYear():Qe.getFullYear()-1}var jt=I[Ne+40>>2>>>0];for(var Jt in Ne={$b:I[Ne>>2>>>0],Zb:I[Ne+4>>2>>>0],Gb:I[Ne+8>>2>>>0],Kb:I[Ne+12>>2>>>0],Hb:I[Ne+16>>2>>>0],Cb:I[Ne+20>>2>>>0],Ab:I[Ne+24>>2>>>0],Bb:I[Ne+28>>2>>>0],bc:I[Ne+32>>2>>>0],Yb:I[Ne+36>>2>>>0],ac:jt?Y(jt):""},Me=Y(Me),jt={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})Me=Me.replace(new RegExp(Jt,"g"),jt[Jt]);var cn="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),un="January February March April May June July August September October November December".split(" ");for(Jt in jt={"%a":function(Qe){return cn[Qe.Ab].substring(0,3)},"%A":function(Qe){return cn[Qe.Ab]},"%b":function(Qe){return un[Qe.Hb].substring(0,3)},"%B":function(Qe){return un[Qe.Hb]},"%C":function(Qe){return qe((Qe.Cb+1900)/100|0,2)},"%d":function(Qe){return qe(Qe.Kb,2)},"%e":function(Qe){return Ge(Qe.Kb,2," ")},"%g":function(Qe){return Lt(Qe).toString().substring(2)},"%G":function(Qe){return Lt(Qe)},"%H":function(Qe){return qe(Qe.Gb,2)},"%I":function(Qe){return(Qe=Qe.Gb)==0?Qe=12:12Qe.Gb?"AM":"PM"},"%S":function(Qe){return qe(Qe.$b,2)},"%t":function(){return" "},"%u":function(Qe){return Qe.Ab||7},"%U":function(Qe){return qe(Math.floor((Qe.Bb+7-Qe.Ab)/7),2)},"%V":function(Qe){var Zt=Math.floor((Qe.Bb+7-(Qe.Ab+6)%7)/7);if(2>=(Qe.Ab+371-Qe.Bb-2)%7&&Zt++,Zt)Zt==53&&((nn=(Qe.Ab+371-Qe.Bb)%7)==4||nn==3&&$t(Qe.Cb)||(Zt=1));else{Zt=52;var nn=(Qe.Ab+7-Qe.Bb-1)%7;(nn==4||nn==5&&$t(Qe.Cb%400-1))&&Zt++}return qe(Zt,2)},"%w":function(Qe){return Qe.Ab},"%W":function(Qe){return qe(Math.floor((Qe.Bb+7-(Qe.Ab+6)%7)/7),2)},"%y":function(Qe){return(Qe.Cb+1900).toString().substring(2)},"%Y":function(Qe){return Qe.Cb+1900},"%z":function(Qe){var Zt=0<=(Qe=Qe.Yb);return Qe=Math.abs(Qe)/60,(Zt?"+":"-")+("0000"+(Qe/60*100+Qe%60)).slice(-4)},"%Z":function(Qe){return Qe.ac},"%%":function(){return"%"}},Me=Me.replace(/%%/g,"\0\0"),jt)Me.includes(Jt)&&(Me=Me.replace(new RegExp(Jt,"g"),jt[Jt](Ne)));return Jt=function(Qe){var Zt=Array(X(Qe)+1);return B(Qe,Zt,0,Zt.length),Zt}(Me=Me.replace(/\0\0/g,"%")),Jt.length>de?0:(k.set(Jt,ie>>>0),Jt.length-1)}var wt={a:function(ie){return It(ie+24)+24},m:function(ie){return(ie=new be(ie)).Pb()||(ie.Ib(!0),Be--),ie.Jb(!1),pe.push(ie),ie.Nb(),ie.Qb()},ia:function(ie){throw P("Unexpected exception thrown, this is not properly supported - aborting"),L=!0,ie},w:function(){Ot(0);var ie=pe.pop();if(ie.Xb()&&!ie.Lb()){var de=ie.Wb();de&&Xe(de)(ie.Db),pt(ie.Db)}ze=0},d:function(){var ie=ze;if(!ie)return Vt=0;var de=new be(ie);de.Fb(ie);var Me=de.Eb();if(!Me)return Vt=0,ie;for(var Ne=Array.prototype.slice.call(arguments),Ge=0;Ge>>2]+4294967296*I[ie+4>>>2])),I[de>>2>>>0]=ie.getUTCSeconds(),I[de+4>>2>>>0]=ie.getUTCMinutes(),I[de+8>>2>>>0]=ie.getUTCHours(),I[de+12>>2>>>0]=ie.getUTCDate(),I[de+16>>2>>>0]=ie.getUTCMonth(),I[de+20>>2>>>0]=ie.getUTCFullYear()-1900,I[de+24>>2>>>0]=ie.getUTCDay(),I[de+28>>2>>>0]=(ie.getTime()-Date.UTC(ie.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(ie,de){ie=new Date(1e3*(W[ie>>>2]+4294967296*I[ie+4>>>2])),I[de>>2>>>0]=ie.getSeconds(),I[de+4>>2>>>0]=ie.getMinutes(),I[de+8>>2>>>0]=ie.getHours(),I[de+12>>2>>>0]=ie.getDate(),I[de+16>>2>>>0]=ie.getMonth(),I[de+20>>2>>>0]=ie.getFullYear()-1900,I[de+24>>2>>>0]=ie.getDay();var Me=new Date(ie.getFullYear(),0,1);I[de+28>>2>>>0]=(ie.getTime()-Me.getTime())/864e5|0,I[de+36>>2>>>0]=-60*ie.getTimezoneOffset();var Ne=new Date(ie.getFullYear(),6,1).getTimezoneOffset();Me=Me.getTimezoneOffset(),I[de+32>>2>>>0]=0|(Ne!=Me&&ie.getTimezoneOffset()==Math.min(Me,Ne))},Fa:function(ie){var de=new Date(I[ie+20>>2>>>0]+1900,I[ie+16>>2>>>0],I[ie+12>>2>>>0],I[ie+8>>2>>>0],I[ie+4>>2>>>0],I[ie>>2>>>0],0),Me=I[ie+32>>2>>>0],Ne=de.getTimezoneOffset(),Ge=new Date(de.getFullYear(),0,1),qe=new Date(de.getFullYear(),6,1).getTimezoneOffset(),At=Ge.getTimezoneOffset(),Ft=Math.min(At,qe);return 0>Me?I[ie+32>>2>>>0]=+(qe!=At&&Ft==Ne):0>2>>>0]=de.getDay(),I[ie+28>>2>>>0]=(de.getTime()-Ge.getTime())/864e5|0,I[ie>>2>>>0]=de.getSeconds(),I[ie+4>>2>>>0]=de.getMinutes(),I[ie+8>>2>>>0]=de.getHours(),I[ie+12>>2>>>0]=de.getDate(),I[ie+16>>2>>>0]=de.getMonth(),de.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function ie(de,Me,Ne){ie.Vb||(ie.Vb=!0,function(Ge,qe,At){function Ft(un){return(un=un.toTimeString().match(/\(([A-Za-z ]+)\)$/))?un[1]:"GMT"}var Lt=new Date().getFullYear(),jt=new Date(Lt,0,1),Jt=new Date(Lt,6,1);Lt=jt.getTimezoneOffset();var cn=Jt.getTimezoneOffset();I[Ge>>2>>>0]=60*Math.max(Lt,cn),I[qe>>2>>>0]=+(Lt!=cn),Ge=Ft(jt),qe=Ft(Jt),Ge=Ce(Ge),qe=Ce(qe),cn>2>>>0]=Ge,W[At+4>>2>>>0]=qe):(W[At>>2>>>0]=qe,W[At+4>>2>>>0]=Ge)}(de,Me,Ne))},B:function(){Ie("")},ma:function(){return 4294901760},I:S?()=>{var ie=process.hrtime();return 1e3*ie[0]+ie[1]/1e6}:()=>performance.now(),xa:function(ie,de,Me){j.copyWithin(ie>>>0,de>>>0,de+Me>>>0)},G:function(ie){var de=j.length;if(4294901760<(ie>>>=0))return!1;for(var Me=1;4>=Me;Me*=2){var Ne=de*(1+.2/Me);Ne=Math.min(Ne,ie+100663296);var Ge=Math;Ne=Math.max(ie,Ne),Ge=Ge.min.call(Ge,4294901760,Ne+(65536-Ne%65536)%65536);e:{try{C.grow(Ge-D.byteLength+65535>>>16),Z();var qe=1;break e}catch{}qe=void 0}if(qe)return!0}return!1},va:function(ie,de){var Me=0;return xt().forEach(function(Ne,Ge){var qe=de+Me;for(Ge=W[ie+4*Ge>>2>>>0]=qe,qe=0;qe>0>>>0]=Ne.charCodeAt(qe);k[Ge>>0>>>0]=0,Me+=Ne.length+1}),0},wa:function(ie,de){var Me=xt();W[ie>>2>>>0]=Me.length;var Ne=0;return Me.forEach(function(Ge){Ne+=Ge.length+1}),W[de>>2>>>0]=Ne,0},ba:function(ie){A||0>2>>>0],Ft=W[de+4>>2>>>0];de+=8;for(var Lt=0;Lt>>0]);Ge+=Ft}return W[Ne>>2>>>0]=Ge,0},c:function(){return Vt},ja:function ie(de,Me){ie.Mb||(ie.Mb=function(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var Ge=new Uint8Array(1);return()=>(crypto.getRandomValues(Ge),Ge[0])}if(S)try{var qe=t(Object(function(){var At=new Error("Cannot find module 'crypto'");throw At.code="MODULE_NOT_FOUND",At}()));return()=>qe.randomBytes(1)[0]}catch{}return()=>Ie("randomDevice")}());for(var Ne=0;Ne>0>>>0]=ie.Mb();return 0},ea:function(ie,de,Me){var Ne=kt();try{return Xe(ie)(de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},fa:function(ie,de,Me){var Ne=kt();try{return Xe(ie)(de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},J:function(ie){var de=kt();try{return Xe(ie)()}catch(Me){if(Bt(de),Me!==Me+0)throw Me;Ot(1,0)}},e:function(ie,de){var Me=kt();try{return Xe(ie)(de)}catch(Ne){if(Bt(Me),Ne!==Ne+0)throw Ne;Ot(1,0)}},N:function(ie,de,Me){var Ne=kt();try{return Xe(ie)(de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},O:function(ie,de,Me){var Ne=kt();try{return Xe(ie)(de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},j:function(ie,de,Me){var Ne=kt();try{return Xe(ie)(de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},o:function(ie,de,Me,Ne){var Ge=kt();try{return Xe(ie)(de,Me,Ne)}catch(qe){if(Bt(Ge),qe!==qe+0)throw qe;Ot(1,0)}},p:function(ie,de,Me,Ne,Ge){var qe=kt();try{return Xe(ie)(de,Me,Ne,Ge)}catch(At){if(Bt(qe),At!==At+0)throw At;Ot(1,0)}},M:function(ie,de,Me,Ne,Ge,qe){var At=kt();try{return Xe(ie)(de,Me,Ne,Ge,qe)}catch(Ft){if(Bt(At),Ft!==Ft+0)throw Ft;Ot(1,0)}},r:function(ie,de,Me,Ne,Ge,qe){var At=kt();try{return Xe(ie)(de,Me,Ne,Ge,qe)}catch(Ft){if(Bt(At),Ft!==Ft+0)throw Ft;Ot(1,0)}},v:function(ie,de,Me,Ne,Ge,qe,At){var Ft=kt();try{return Xe(ie)(de,Me,Ne,Ge,qe,At)}catch(Lt){if(Bt(Ft),Lt!==Lt+0)throw Lt;Ot(1,0)}},K:function(ie,de,Me,Ne,Ge,qe,At,Ft){var Lt=kt();try{return Xe(ie)(de,Me,Ne,Ge,qe,At,Ft)}catch(jt){if(Bt(Lt),jt!==jt+0)throw jt;Ot(1,0)}},D:function(ie,de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt,cn){var un=kt();try{return Xe(ie)(de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt,cn)}catch(Qe){if(Bt(un),Qe!==Qe+0)throw Qe;Ot(1,0)}},X:function(ie,de,Me,Ne,Ge,qe,At,Ft){var Lt=kt();try{return vn(ie,de,Me,Ne,Ge,qe,At,Ft)}catch(jt){if(Bt(Lt),jt!==jt+0)throw jt;Ot(1,0)}},V:function(ie,de,Me,Ne,Ge,qe,At){var Ft=kt();try{return Rn(ie,de,Me,Ne,Ge,qe,At)}catch(Lt){if(Bt(Ft),Lt!==Lt+0)throw Lt;Ot(1,0)}},U:function(ie,de,Me,Ne,Ge){var qe=kt();try{return yn(ie,de,Me,Ne,Ge)}catch(At){if(Bt(qe),At!==At+0)throw At;Ot(1,0)}},Z:function(ie,de,Me,Ne){var Ge=kt();try{return On(ie,de,Me,Ne)}catch(qe){if(Bt(Ge),qe!==qe+0)throw qe;Ot(1,0)}},W:function(ie){var de=kt();try{return In(ie)}catch(Me){if(Bt(de),Me!==Me+0)throw Me;Ot(1,0)}},Y:function(ie,de){var Me=kt();try{return kn(ie,de)}catch(Ne){if(Bt(Me),Ne!==Ne+0)throw Ne;Ot(1,0)}},T:function(ie,de,Me){var Ne=kt();try{return hn(ie,de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},f:function(ie){var de=kt();try{Xe(ie)()}catch(Me){if(Bt(de),Me!==Me+0)throw Me;Ot(1,0)}},q:function(ie,de){var Me=kt();try{Xe(ie)(de)}catch(Ne){if(Bt(Me),Ne!==Ne+0)throw Ne;Ot(1,0)}},h:function(ie,de,Me){var Ne=kt();try{Xe(ie)(de,Me)}catch(Ge){if(Bt(Ne),Ge!==Ge+0)throw Ge;Ot(1,0)}},da:function(ie,de,Me,Ne){var Ge=kt();try{Xe(ie)(de,Me,Ne)}catch(qe){if(Bt(Ge),qe!==qe+0)throw qe;Ot(1,0)}},l:function(ie,de,Me,Ne){var Ge=kt();try{Xe(ie)(de,Me,Ne)}catch(qe){if(Bt(Ge),qe!==qe+0)throw qe;Ot(1,0)}},t:function(ie,de,Me,Ne,Ge){var qe=kt();try{Xe(ie)(de,Me,Ne,Ge)}catch(At){if(Bt(qe),At!==At+0)throw At;Ot(1,0)}},u:function(ie,de,Me,Ne,Ge,qe){var At=kt();try{Xe(ie)(de,Me,Ne,Ge,qe)}catch(Ft){if(Bt(At),Ft!==Ft+0)throw Ft;Ot(1,0)}},x:function(ie,de,Me,Ne,Ge,qe,At){var Ft=kt();try{Xe(ie)(de,Me,Ne,Ge,qe,At)}catch(Lt){if(Bt(Ft),Lt!==Lt+0)throw Lt;Ot(1,0)}},z:function(ie,de,Me,Ne,Ge,qe,At,Ft){var Lt=kt();try{Xe(ie)(de,Me,Ne,Ge,qe,At,Ft)}catch(jt){if(Bt(Lt),jt!==jt+0)throw jt;Ot(1,0)}},ga:function(ie,de,Me,Ne,Ge,qe,At,Ft,Lt){var jt=kt();try{Xe(ie)(de,Me,Ne,Ge,qe,At,Ft,Lt)}catch(Jt){if(Bt(jt),Jt!==Jt+0)throw Jt;Ot(1,0)}},A:function(ie,de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt){var cn=kt();try{Xe(ie)(de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt)}catch(un){if(Bt(cn),un!==un+0)throw un;Ot(1,0)}},C:function(ie,de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt,cn,un,Qe,Zt,nn){var xn=kt();try{Xe(ie)(de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt,cn,un,Qe,Zt,nn)}catch(Nn){if(Bt(xn),Nn!==Nn+0)throw Nn;Ot(1,0)}},aa:function(ie,de,Me,Ne,Ge,qe,At,Ft){var Lt=kt();try{Sn(ie,de,Me,Ne,Ge,qe,At,Ft)}catch(jt){if(Bt(Lt),jt!==jt+0)throw jt;Ot(1,0)}},_:function(ie,de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt,cn){var un=kt();try{Mn(ie,de,Me,Ne,Ge,qe,At,Ft,Lt,jt,Jt,cn)}catch(Qe){if(Bt(un),Qe!==Qe+0)throw Qe;Ot(1,0)}},$:function(ie,de,Me,Ne,Ge,qe){var At=kt();try{mn(ie,de,Me,Ne,Ge,qe)}catch(Ft){if(Bt(At),Ft!==Ft+0)throw Ft;Ot(1,0)}},n:function(ie){return ie},F:function(ie){Vt=ie},ha:ce,y:function(ie,de,Me,Ne){return ce(ie,de,Me,Ne)}};(function(){function ie(Ge){l.asm=Ge.exports,C=l.asm.Ka,Z(),z=l.asm.ib,fe.unshift(l.asm.La),ue--,l.monitorRunDependencies&&l.monitorRunDependencies(ue),ue==0&&ke&&(Ge=ke,ke=null,Ge())}function de(Ge){ie(Ge.instance)}function Me(Ge){return function(){if(!E&&(x||w)){if(typeof fetch=="function"&&!K.startsWith("file://"))return fetch(K,{credentials:"same-origin"}).then(function(qe){if(!qe.ok)throw"failed to load wasm binary file at '"+K+"'";return qe.arrayBuffer()}).catch(function(){return le()});if(m)return new Promise(function(qe,At){m(K,function(Ft){qe(new Uint8Array(Ft))},At)})}return Promise.resolve().then(function(){return le()})}().then(function(qe){return WebAssembly.instantiate(qe,Ne)}).then(function(qe){return qe}).then(Ge,function(qe){P("failed to asynchronously prepare wasm: "+qe),Ie(qe)})}var Ne={a:wt};if(ue++,l.monitorRunDependencies&&l.monitorRunDependencies(ue),l.instantiateWasm)try{return l.instantiateWasm(Ne,ie)}catch(Ge){return P("Module.instantiateWasm callback failed with error: "+Ge),!1}(E||typeof WebAssembly.instantiateStreaming!="function"||F()||K.startsWith("file://")||S||typeof fetch!="function"?Me(de):fetch(K,{credentials:"same-origin"}).then(function(Ge){return WebAssembly.instantiateStreaming(Ge,Ne).then(de,function(qe){return P("wasm streaming compile failed: "+qe),P("falling back to ArrayBuffer instantiation"),Me(de)})})).catch(d)})(),l.___wasm_call_ctors=function(){return(l.___wasm_call_ctors=l.asm.La).apply(null,arguments)},l._OrtInit=function(){return(l._OrtInit=l.asm.Ma).apply(null,arguments)},l._OrtCreateSessionOptions=function(){return(l._OrtCreateSessionOptions=l.asm.Na).apply(null,arguments)},l._OrtAppendExecutionProvider=function(){return(l._OrtAppendExecutionProvider=l.asm.Oa).apply(null,arguments)},l._OrtAddSessionConfigEntry=function(){return(l._OrtAddSessionConfigEntry=l.asm.Pa).apply(null,arguments)},l._OrtReleaseSessionOptions=function(){return(l._OrtReleaseSessionOptions=l.asm.Qa).apply(null,arguments)},l._OrtCreateSession=function(){return(l._OrtCreateSession=l.asm.Ra).apply(null,arguments)},l._OrtReleaseSession=function(){return(l._OrtReleaseSession=l.asm.Sa).apply(null,arguments)},l._OrtGetInputCount=function(){return(l._OrtGetInputCount=l.asm.Ta).apply(null,arguments)},l._OrtGetOutputCount=function(){return(l._OrtGetOutputCount=l.asm.Ua).apply(null,arguments)},l._OrtGetInputName=function(){return(l._OrtGetInputName=l.asm.Va).apply(null,arguments)},l._OrtGetOutputName=function(){return(l._OrtGetOutputName=l.asm.Wa).apply(null,arguments)},l._OrtFree=function(){return(l._OrtFree=l.asm.Xa).apply(null,arguments)},l._OrtCreateTensor=function(){return(l._OrtCreateTensor=l.asm.Ya).apply(null,arguments)},l._OrtGetTensorData=function(){return(l._OrtGetTensorData=l.asm.Za).apply(null,arguments)},l._OrtReleaseTensor=function(){return(l._OrtReleaseTensor=l.asm._a).apply(null,arguments)},l._OrtCreateRunOptions=function(){return(l._OrtCreateRunOptions=l.asm.$a).apply(null,arguments)},l._OrtAddRunConfigEntry=function(){return(l._OrtAddRunConfigEntry=l.asm.ab).apply(null,arguments)},l._OrtReleaseRunOptions=function(){return(l._OrtReleaseRunOptions=l.asm.bb).apply(null,arguments)},l._OrtRun=function(){return(l._OrtRun=l.asm.cb).apply(null,arguments)},l._OrtEndProfiling=function(){return(l._OrtEndProfiling=l.asm.db).apply(null,arguments)};var Ct,It=l._malloc=function(){return(It=l._malloc=l.asm.eb).apply(null,arguments)},Dt=l._free=function(){return(Dt=l._free=l.asm.fb).apply(null,arguments)},rn=l._fflush=function(){return(rn=l._fflush=l.asm.gb).apply(null,arguments)},tn=l.___funcs_on_exit=function(){return(tn=l.___funcs_on_exit=l.asm.hb).apply(null,arguments)},Ot=l._setThrew=function(){return(Ot=l._setThrew=l.asm.jb).apply(null,arguments)},kt=l.stackSave=function(){return(kt=l.stackSave=l.asm.kb).apply(null,arguments)},Bt=l.stackRestore=function(){return(Bt=l.stackRestore=l.asm.lb).apply(null,arguments)},ln=l.stackAlloc=function(){return(ln=l.stackAlloc=l.asm.mb).apply(null,arguments)},en=l.___cxa_can_catch=function(){return(en=l.___cxa_can_catch=l.asm.nb).apply(null,arguments)},dn=l.___cxa_is_pointer_type=function(){return(dn=l.___cxa_is_pointer_type=l.asm.ob).apply(null,arguments)},In=l.dynCall_j=function(){return(In=l.dynCall_j=l.asm.pb).apply(null,arguments)},Rn=l.dynCall_iiiiij=function(){return(Rn=l.dynCall_iiiiij=l.asm.qb).apply(null,arguments)},hn=l.dynCall_jii=function(){return(hn=l.dynCall_jii=l.asm.rb).apply(null,arguments)},Sn=l.dynCall_viiiiij=function(){return(Sn=l.dynCall_viiiiij=l.asm.sb).apply(null,arguments)},mn=l.dynCall_vjji=function(){return(mn=l.dynCall_vjji=l.asm.tb).apply(null,arguments)},Mn=l.dynCall_viiijjjii=function(){return(Mn=l.dynCall_viiijjjii=l.asm.ub).apply(null,arguments)},On=l.dynCall_iij=function(){return(On=l.dynCall_iij=l.asm.vb).apply(null,arguments)},kn=l.dynCall_ji=function(){return(kn=l.dynCall_ji=l.asm.wb).apply(null,arguments)},vn=l.dynCall_iiiiiij=function(){return(vn=l.dynCall_iiiiiij=l.asm.xb).apply(null,arguments)},yn=l.dynCall_iiij=function(){return(yn=l.dynCall_iiij=l.asm.yb).apply(null,arguments)};function Ln(){function ie(){if(!Ct&&(Ct=!0,l.calledRun=!0,!L)){if(oe(fe),u(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;){var de=l.postRun.shift();ft.unshift(de)}oe(ft)}}if(!(0{r.exports=function(e,t){for(var n=new Array(arguments.length-1),i=0,a=2,l=!0;a{var t=e;t.length=function(u){var d=u.length;if(!d)return 0;for(var f=0;--d%4>1&&u.charAt(d)==="=";)++f;return Math.ceil(3*u.length)/4-f};for(var n=new Array(64),i=new Array(123),a=0;a<64;)i[n[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;t.encode=function(u,d,f){for(var m,s=null,o=[],c=0,v=0;d>2],m=(3&y)<<4,v=1;break;case 1:o[c++]=n[m|y>>4],m=(15&y)<<2,v=2;break;case 2:o[c++]=n[m|y>>6],o[c++]=n[63&y],v=0}c>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),c=0)}return v&&(o[c++]=n[m],o[c++]=61,v===1&&(o[c++]=61)),s?(c&&s.push(String.fromCharCode.apply(String,o.slice(0,c))),s.join("")):String.fromCharCode.apply(String,o.slice(0,c))};var l="invalid encoding";t.decode=function(u,d,f){for(var m,s=f,o=0,c=0;c1)break;if((v=i[v])===void 0)throw Error(l);switch(o){case 0:m=v,o=1;break;case 1:d[f++]=m<<2|(48&v)>>4,m=v,o=2;break;case 2:d[f++]=(15&m)<<4|(60&v)>>2,m=v,o=3;break;case 3:d[f++]=(3&m)<<6|v,o=0}}if(o===1)throw Error(l);return f-s},t.test=function(u){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(u)}},9211:r=>{function e(){this._listeners={}}r.exports=e,e.prototype.on=function(t,n,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:n,ctx:i||this}),this},e.prototype.off=function(t,n){if(t===void 0)this._listeners={};else if(n===void 0)this._listeners[t]=[];else for(var i=this._listeners[t],a=0;a{function e(l){return typeof Float32Array<"u"?function(){var u=new Float32Array([-0]),d=new Uint8Array(u.buffer),f=d[3]===128;function m(v,y,_){u[0]=v,y[_]=d[0],y[_+1]=d[1],y[_+2]=d[2],y[_+3]=d[3]}function s(v,y,_){u[0]=v,y[_]=d[3],y[_+1]=d[2],y[_+2]=d[1],y[_+3]=d[0]}function o(v,y){return d[0]=v[y],d[1]=v[y+1],d[2]=v[y+2],d[3]=v[y+3],u[0]}function c(v,y){return d[3]=v[y],d[2]=v[y+1],d[1]=v[y+2],d[0]=v[y+3],u[0]}l.writeFloatLE=f?m:s,l.writeFloatBE=f?s:m,l.readFloatLE=f?o:c,l.readFloatBE=f?c:o}():function(){function u(f,m,s,o){var c=m<0?1:0;if(c&&(m=-m),m===0)f(1/m>0?0:2147483648,s,o);else if(isNaN(m))f(2143289344,s,o);else if(m>34028234663852886e22)f((c<<31|2139095040)>>>0,s,o);else if(m<11754943508222875e-54)f((c<<31|Math.round(m/1401298464324817e-60))>>>0,s,o);else{var v=Math.floor(Math.log(m)/Math.LN2);f((c<<31|v+127<<23|8388607&Math.round(m*Math.pow(2,-v)*8388608))>>>0,s,o)}}function d(f,m,s){var o=f(m,s),c=2*(o>>31)+1,v=o>>>23&255,y=8388607&o;return v===255?y?NaN:c*(1/0):v===0?1401298464324817e-60*c*y:c*Math.pow(2,v-150)*(y+8388608)}l.writeFloatLE=u.bind(null,t),l.writeFloatBE=u.bind(null,n),l.readFloatLE=d.bind(null,i),l.readFloatBE=d.bind(null,a)}(),typeof Float64Array<"u"?function(){var u=new Float64Array([-0]),d=new Uint8Array(u.buffer),f=d[7]===128;function m(v,y,_){u[0]=v,y[_]=d[0],y[_+1]=d[1],y[_+2]=d[2],y[_+3]=d[3],y[_+4]=d[4],y[_+5]=d[5],y[_+6]=d[6],y[_+7]=d[7]}function s(v,y,_){u[0]=v,y[_]=d[7],y[_+1]=d[6],y[_+2]=d[5],y[_+3]=d[4],y[_+4]=d[3],y[_+5]=d[2],y[_+6]=d[1],y[_+7]=d[0]}function o(v,y){return d[0]=v[y],d[1]=v[y+1],d[2]=v[y+2],d[3]=v[y+3],d[4]=v[y+4],d[5]=v[y+5],d[6]=v[y+6],d[7]=v[y+7],u[0]}function c(v,y){return d[7]=v[y],d[6]=v[y+1],d[5]=v[y+2],d[4]=v[y+3],d[3]=v[y+4],d[2]=v[y+5],d[1]=v[y+6],d[0]=v[y+7],u[0]}l.writeDoubleLE=f?m:s,l.writeDoubleBE=f?s:m,l.readDoubleLE=f?o:c,l.readDoubleBE=f?c:o}():function(){function u(f,m,s,o,c,v){var y=o<0?1:0;if(y&&(o=-o),o===0)f(0,c,v+m),f(1/o>0?0:2147483648,c,v+s);else if(isNaN(o))f(0,c,v+m),f(2146959360,c,v+s);else if(o>17976931348623157e292)f(0,c,v+m),f((y<<31|2146435072)>>>0,c,v+s);else{var _;if(o<22250738585072014e-324)f((_=o/5e-324)>>>0,c,v+m),f((y<<31|_/4294967296)>>>0,c,v+s);else{var b=Math.floor(Math.log(o)/Math.LN2);b===1024&&(b=1023),f(4503599627370496*(_=o*Math.pow(2,-b))>>>0,c,v+m),f((y<<31|b+1023<<20|1048576*_&1048575)>>>0,c,v+s)}}}function d(f,m,s,o,c){var v=f(o,c+m),y=f(o,c+s),_=2*(y>>31)+1,b=y>>>20&2047,x=4294967296*(1048575&y)+v;return b===2047?x?NaN:_*(1/0):b===0?5e-324*_*x:_*Math.pow(2,b-1075)*(x+4503599627370496)}l.writeDoubleLE=u.bind(null,t,0,4),l.writeDoubleBE=u.bind(null,n,4,0),l.readDoubleLE=d.bind(null,i,0,4),l.readDoubleBE=d.bind(null,a,4,0)}(),l}function t(l,u,d){u[d]=255&l,u[d+1]=l>>>8&255,u[d+2]=l>>>16&255,u[d+3]=l>>>24}function n(l,u,d){u[d]=l>>>24,u[d+1]=l>>>16&255,u[d+2]=l>>>8&255,u[d+3]=255&l}function i(l,u){return(l[u]|l[u+1]<<8|l[u+2]<<16|l[u+3]<<24)>>>0}function a(l,u){return(l[u]<<24|l[u+1]<<16|l[u+2]<<8|l[u+3])>>>0}r.exports=e(e)},7199:module=>{function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}module.exports=inquire},6662:r=>{r.exports=function(e,t,n){var i=n||8192,a=i>>>1,l=null,u=i;return function(d){if(d<1||d>a)return e(d);u+d>i&&(l=e(i),u=0);var f=t.call(l,u,u+=d);return 7&u&&(u=1+(7|u)),f}}},4997:(r,e)=>{var t=e;t.length=function(n){for(var i=0,a=0,l=0;l191&&l<224?d[f++]=(31&l)<<6|63&n[i++]:l>239&&l<365?(l=((7&l)<<18|(63&n[i++])<<12|(63&n[i++])<<6|63&n[i++])-65536,d[f++]=55296+(l>>10),d[f++]=56320+(1023&l)):d[f++]=(15&l)<<12|(63&n[i++])<<6|63&n[i++],f>8191&&((u||(u=[])).push(String.fromCharCode.apply(String,d)),f=0);return u?(f&&u.push(String.fromCharCode.apply(String,d.slice(0,f))),u.join("")):String.fromCharCode.apply(String,d.slice(0,f))},t.write=function(n,i,a){for(var l,u,d=a,f=0;f>6|192,i[a++]=63&l|128):(64512&l)==55296&&(64512&(u=n.charCodeAt(f+1)))==56320?(l=65536+((1023&l)<<10)+(1023&u),++f,i[a++]=l>>18|240,i[a++]=l>>12&63|128,i[a++]=l>>6&63|128,i[a++]=63&l|128):(i[a++]=l>>12|224,i[a++]=l>>6&63|128,i[a++]=63&l|128);return a-d}},3442:(r,e)=>{e.__esModule=!0;var t=function(){function n(i){if(!i)throw new TypeError("Invalid argument; `value` has no value.");this.value=n.EMPTY,i&&n.isGuid(i)&&(this.value=i)}return n.isGuid=function(i){var a=i.toString();return i&&(i instanceof n||n.validator.test(a))},n.create=function(){return new n([n.gen(2),n.gen(1),n.gen(1),n.gen(1),n.gen(3)].join("-"))},n.createEmpty=function(){return new n("emptyguid")},n.parse=function(i){return new n(i)},n.raw=function(){return[n.gen(2),n.gen(1),n.gen(1),n.gen(1),n.gen(3)].join("-")},n.gen=function(i){for(var a="",l=0;l{r.exports=t;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function t(A,C,D){this.low=0|A,this.high=0|C,this.unsigned=!!D}function n(A){return(A&&A.__isLong__)===!0}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0}),t.isLong=n;var i={},a={};function l(A,C){var D,k,j;return C?(j=0<=(A>>>=0)&&A<256)&&(k=a[A])?k:(D=d(A,(0|A)<0?-1:0,!0),j&&(a[A]=D),D):(j=-128<=(A|=0)&&A<128)&&(k=i[A])?k:(D=d(A,A<0?-1:0,!1),j&&(i[A]=D),D)}function u(A,C){if(isNaN(A))return C?b:_;if(C){if(A<0)return b;if(A>=c)return E}else{if(A<=-v)return M;if(A+1>=v)return T}return A<0?u(-A,C).neg():d(A%o|0,A/o|0,C)}function d(A,C,D){return new t(A,C,D)}t.fromInt=l,t.fromNumber=u,t.fromBits=d;var f=Math.pow;function m(A,C,D){if(A.length===0)throw Error("empty string");if(A==="NaN"||A==="Infinity"||A==="+Infinity"||A==="-Infinity")return _;if(typeof C=="number"?(D=C,C=!1):C=!!C,(D=D||10)<2||360)throw Error("interior hyphen");if(k===0)return m(A.substring(1),C,D).neg();for(var j=u(f(D,8)),I=_,W=0;W>>0:this.low},P.toNumber=function(){return this.unsigned?(this.high>>>0)*o+(this.low>>>0):this.high*o+(this.low>>>0)},P.toString=function(A){if((A=A||10)<2||36>>0).toString(A);if((I=L).isZero())return U+W;for(;U.length<6;)U="0"+U;W=""+U+W}},P.getHighBits=function(){return this.high},P.getHighBitsUnsigned=function(){return this.high>>>0},P.getLowBits=function(){return this.low},P.getLowBitsUnsigned=function(){return this.low>>>0},P.getNumBitsAbs=function(){if(this.isNegative())return this.eq(M)?64:this.neg().getNumBitsAbs();for(var A=this.high!=0?this.high:this.low,C=31;C>0&&!(A&1<=0},P.isOdd=function(){return(1&this.low)==1},P.isEven=function(){return(1&this.low)==0},P.equals=function(A){return n(A)||(A=s(A)),(this.unsigned===A.unsigned||this.high>>>31!=1||A.high>>>31!=1)&&this.high===A.high&&this.low===A.low},P.eq=P.equals,P.notEquals=function(A){return!this.eq(A)},P.neq=P.notEquals,P.ne=P.notEquals,P.lessThan=function(A){return this.comp(A)<0},P.lt=P.lessThan,P.lessThanOrEqual=function(A){return this.comp(A)<=0},P.lte=P.lessThanOrEqual,P.le=P.lessThanOrEqual,P.greaterThan=function(A){return this.comp(A)>0},P.gt=P.greaterThan,P.greaterThanOrEqual=function(A){return this.comp(A)>=0},P.gte=P.greaterThanOrEqual,P.ge=P.greaterThanOrEqual,P.compare=function(A){if(n(A)||(A=s(A)),this.eq(A))return 0;var C=this.isNegative(),D=A.isNegative();return C&&!D?-1:!C&&D?1:this.unsigned?A.high>>>0>this.high>>>0||A.high===this.high&&A.low>>>0>this.low>>>0?-1:1:this.sub(A).isNegative()?-1:1},P.comp=P.compare,P.negate=function(){return!this.unsigned&&this.eq(M)?M:this.not().add(x)},P.neg=P.negate,P.add=function(A){n(A)||(A=s(A));var C=this.high>>>16,D=65535&this.high,k=this.low>>>16,j=65535&this.low,I=A.high>>>16,W=65535&A.high,L=A.low>>>16,U=0,H=0,Y=0,B=0;return Y+=(B+=j+(65535&A.low))>>>16,H+=(Y+=k+L)>>>16,U+=(H+=D+W)>>>16,U+=C+I,d((Y&=65535)<<16|(B&=65535),(U&=65535)<<16|(H&=65535),this.unsigned)},P.subtract=function(A){return n(A)||(A=s(A)),this.add(A.neg())},P.sub=P.subtract,P.multiply=function(A){if(this.isZero())return _;if(n(A)||(A=s(A)),e)return d(e.mul(this.low,this.high,A.low,A.high),e.get_high(),this.unsigned);if(A.isZero())return _;if(this.eq(M))return A.isOdd()?M:_;if(A.eq(M))return this.isOdd()?M:_;if(this.isNegative())return A.isNegative()?this.neg().mul(A.neg()):this.neg().mul(A).neg();if(A.isNegative())return this.mul(A.neg()).neg();if(this.lt(y)&&A.lt(y))return u(this.toNumber()*A.toNumber(),this.unsigned);var C=this.high>>>16,D=65535&this.high,k=this.low>>>16,j=65535&this.low,I=A.high>>>16,W=65535&A.high,L=A.low>>>16,U=65535&A.low,H=0,Y=0,B=0,X=0;return B+=(X+=j*U)>>>16,Y+=(B+=k*U)>>>16,B&=65535,Y+=(B+=j*L)>>>16,H+=(Y+=D*U)>>>16,Y&=65535,H+=(Y+=k*L)>>>16,Y&=65535,H+=(Y+=j*W)>>>16,H+=C*U+D*L+k*W+j*I,d((B&=65535)<<16|(X&=65535),(H&=65535)<<16|(Y&=65535),this.unsigned)},P.mul=P.multiply,P.divide=function(A){if(n(A)||(A=s(A)),A.isZero())throw Error("division by zero");var C,D,k;if(e)return this.unsigned||this.high!==-2147483648||A.low!==-1||A.high!==-1?d((this.unsigned?e.div_u:e.div_s)(this.low,this.high,A.low,A.high),e.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:_;if(this.unsigned){if(A.unsigned||(A=A.toUnsigned()),A.gt(this))return b;if(A.gt(this.shru(1)))return w;k=b}else{if(this.eq(M))return A.eq(x)||A.eq(S)?M:A.eq(M)?x:(C=this.shr(1).div(A).shl(1)).eq(_)?A.isNegative()?x:S:(D=this.sub(A.mul(C)),k=C.add(D.div(A)));if(A.eq(M))return this.unsigned?b:_;if(this.isNegative())return A.isNegative()?this.neg().div(A.neg()):this.neg().div(A).neg();if(A.isNegative())return this.div(A.neg()).neg();k=_}for(D=this;D.gte(A);){C=Math.max(1,Math.floor(D.toNumber()/A.toNumber()));for(var j=Math.ceil(Math.log(C)/Math.LN2),I=j<=48?1:f(2,j-48),W=u(C),L=W.mul(A);L.isNegative()||L.gt(D);)L=(W=u(C-=I,this.unsigned)).mul(A);W.isZero()&&(W=x),k=k.add(W),D=D.sub(L)}return k},P.div=P.divide,P.modulo=function(A){return n(A)||(A=s(A)),e?d((this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,A.low,A.high),e.get_high(),this.unsigned):this.sub(this.div(A).mul(A))},P.mod=P.modulo,P.rem=P.modulo,P.not=function(){return d(~this.low,~this.high,this.unsigned)},P.and=function(A){return n(A)||(A=s(A)),d(this.low&A.low,this.high&A.high,this.unsigned)},P.or=function(A){return n(A)||(A=s(A)),d(this.low|A.low,this.high|A.high,this.unsigned)},P.xor=function(A){return n(A)||(A=s(A)),d(this.low^A.low,this.high^A.high,this.unsigned)},P.shiftLeft=function(A){return n(A)&&(A=A.toInt()),(A&=63)==0?this:A<32?d(this.low<>>32-A,this.unsigned):d(0,this.low<>>A|this.high<<32-A,this.high>>A,this.unsigned):d(this.high>>A-32,this.high>=0?0:-1,this.unsigned)},P.shr=P.shiftRight,P.shiftRightUnsigned=function(A){if(n(A)&&(A=A.toInt()),(A&=63)==0)return this;var C=this.high;return A<32?d(this.low>>>A|C<<32-A,C>>>A,this.unsigned):d(A===32?C:C>>>A-32,0,this.unsigned)},P.shru=P.shiftRightUnsigned,P.shr_u=P.shiftRightUnsigned,P.toSigned=function(){return this.unsigned?d(this.low,this.high,!1):this},P.toUnsigned=function(){return this.unsigned?this:d(this.low,this.high,!0)},P.toBytes=function(A){return A?this.toBytesLE():this.toBytesBE()},P.toBytesLE=function(){var A=this.high,C=this.low;return[255&C,C>>>8&255,C>>>16&255,C>>>24,255&A,A>>>8&255,A>>>16&255,A>>>24]},P.toBytesBE=function(){var A=this.high,C=this.low;return[A>>>24,A>>>16&255,A>>>8&255,255&A,C>>>24,C>>>16&255,C>>>8&255,255&C]},t.fromBytes=function(A,C,D){return D?t.fromBytesLE(A,C):t.fromBytesBE(A,C)},t.fromBytesLE=function(A,C){return new t(A[0]|A[1]<<8|A[2]<<16|A[3]<<24,A[4]|A[5]<<8|A[6]<<16|A[7]<<24,C)},t.fromBytesBE=function(A,C){return new t(A[4]<<24|A[5]<<16|A[6]<<8|A[7],A[0]<<24|A[1]<<16|A[2]<<8|A[3],C)}},1446:(r,e,t)=>{var n,i,a,l=t(2100),u=l.Reader,d=l.Writer,f=l.util,m=l.roots.default||(l.roots.default={});m.onnx=((a={}).Version=(n={},(i=Object.create(n))[n[0]="_START_VERSION"]=0,i[n[1]="IR_VERSION_2017_10_10"]=1,i[n[2]="IR_VERSION_2017_10_30"]=2,i[n[3]="IR_VERSION_2017_11_3"]=3,i[n[4]="IR_VERSION_2019_1_22"]=4,i[n[5]="IR_VERSION"]=5,i),a.AttributeProto=function(){function s(o){if(this.floats=[],this.ints=[],this.strings=[],this.tensors=[],this.graphs=[],o)for(var c=Object.keys(o),v=0;v>>3){case 1:y.name=o.string();break;case 21:y.refAttrName=o.string();break;case 13:y.docString=o.string();break;case 20:y.type=o.int32();break;case 2:y.f=o.float();break;case 3:y.i=o.int64();break;case 4:y.s=o.bytes();break;case 5:y.t=m.onnx.TensorProto.decode(o,o.uint32());break;case 6:y.g=m.onnx.GraphProto.decode(o,o.uint32());break;case 7:if(y.floats&&y.floats.length||(y.floats=[]),(7&_)==2)for(var b=o.uint32()+o.pos;o.pos>>0,o.i.high>>>0).toNumber())),o.s!=null&&(typeof o.s=="string"?f.base64.decode(o.s,c.s=f.newBuffer(f.base64.length(o.s)),0):o.s.length&&(c.s=o.s)),o.t!=null){if(typeof o.t!="object")throw TypeError(".onnx.AttributeProto.t: object expected");c.t=m.onnx.TensorProto.fromObject(o.t)}if(o.g!=null){if(typeof o.g!="object")throw TypeError(".onnx.AttributeProto.g: object expected");c.g=m.onnx.GraphProto.fromObject(o.g)}if(o.floats){if(!Array.isArray(o.floats))throw TypeError(".onnx.AttributeProto.floats: array expected");c.floats=[];for(var v=0;v>>0,o.ints[v].high>>>0).toNumber())}if(o.strings){if(!Array.isArray(o.strings))throw TypeError(".onnx.AttributeProto.strings: array expected");for(c.strings=[],v=0;v>>0,o.i.high>>>0).toNumber():o.i),o.s!=null&&o.hasOwnProperty("s")&&(v.s=c.bytes===String?f.base64.encode(o.s,0,o.s.length):c.bytes===Array?Array.prototype.slice.call(o.s):o.s),o.t!=null&&o.hasOwnProperty("t")&&(v.t=m.onnx.TensorProto.toObject(o.t,c)),o.g!=null&&o.hasOwnProperty("g")&&(v.g=m.onnx.GraphProto.toObject(o.g,c)),o.floats&&o.floats.length){v.floats=[];for(var _=0;_>>0,o.ints[_].high>>>0).toNumber():o.ints[_];if(o.strings&&o.strings.length)for(v.strings=[],_=0;_>>3){case 1:y.name=o.string();break;case 2:y.type=m.onnx.TypeProto.decode(o,o.uint32());break;case 3:y.docString=o.string();break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.name!=null&&o.hasOwnProperty("name")&&!f.isString(o.name))return"name: string expected";if(o.type!=null&&o.hasOwnProperty("type")){var c=m.onnx.TypeProto.verify(o.type);if(c)return"type."+c}return o.docString!=null&&o.hasOwnProperty("docString")&&!f.isString(o.docString)?"docString: string expected":null},s.fromObject=function(o){if(o instanceof m.onnx.ValueInfoProto)return o;var c=new m.onnx.ValueInfoProto;if(o.name!=null&&(c.name=String(o.name)),o.type!=null){if(typeof o.type!="object")throw TypeError(".onnx.ValueInfoProto.type: object expected");c.type=m.onnx.TypeProto.fromObject(o.type)}return o.docString!=null&&(c.docString=String(o.docString)),c},s.toObject=function(o,c){c||(c={});var v={};return c.defaults&&(v.name="",v.type=null,v.docString=""),o.name!=null&&o.hasOwnProperty("name")&&(v.name=o.name),o.type!=null&&o.hasOwnProperty("type")&&(v.type=m.onnx.TypeProto.toObject(o.type,c)),o.docString!=null&&o.hasOwnProperty("docString")&&(v.docString=o.docString),v},s.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},s}(),a.NodeProto=function(){function s(o){if(this.input=[],this.output=[],this.attribute=[],o)for(var c=Object.keys(o),v=0;v>>3){case 1:y.input&&y.input.length||(y.input=[]),y.input.push(o.string());break;case 2:y.output&&y.output.length||(y.output=[]),y.output.push(o.string());break;case 3:y.name=o.string();break;case 4:y.opType=o.string();break;case 7:y.domain=o.string();break;case 5:y.attribute&&y.attribute.length||(y.attribute=[]),y.attribute.push(m.onnx.AttributeProto.decode(o,o.uint32()));break;case 6:y.docString=o.string();break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.input!=null&&o.hasOwnProperty("input")){if(!Array.isArray(o.input))return"input: array expected";for(var c=0;c>>3){case 1:y.irVersion=o.int64();break;case 8:y.opsetImport&&y.opsetImport.length||(y.opsetImport=[]),y.opsetImport.push(m.onnx.OperatorSetIdProto.decode(o,o.uint32()));break;case 2:y.producerName=o.string();break;case 3:y.producerVersion=o.string();break;case 4:y.domain=o.string();break;case 5:y.modelVersion=o.int64();break;case 6:y.docString=o.string();break;case 7:y.graph=m.onnx.GraphProto.decode(o,o.uint32());break;case 14:y.metadataProps&&y.metadataProps.length||(y.metadataProps=[]),y.metadataProps.push(m.onnx.StringStringEntryProto.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.irVersion!=null&&o.hasOwnProperty("irVersion")&&!(f.isInteger(o.irVersion)||o.irVersion&&f.isInteger(o.irVersion.low)&&f.isInteger(o.irVersion.high)))return"irVersion: integer|Long expected";if(o.opsetImport!=null&&o.hasOwnProperty("opsetImport")){if(!Array.isArray(o.opsetImport))return"opsetImport: array expected";for(var c=0;c>>0,o.irVersion.high>>>0).toNumber())),o.opsetImport){if(!Array.isArray(o.opsetImport))throw TypeError(".onnx.ModelProto.opsetImport: array expected");c.opsetImport=[];for(var v=0;v>>0,o.modelVersion.high>>>0).toNumber())),o.docString!=null&&(c.docString=String(o.docString)),o.graph!=null){if(typeof o.graph!="object")throw TypeError(".onnx.ModelProto.graph: object expected");c.graph=m.onnx.GraphProto.fromObject(o.graph)}if(o.metadataProps){if(!Array.isArray(o.metadataProps))throw TypeError(".onnx.ModelProto.metadataProps: array expected");for(c.metadataProps=[],v=0;v>>0,o.irVersion.high>>>0).toNumber():o.irVersion),o.producerName!=null&&o.hasOwnProperty("producerName")&&(v.producerName=o.producerName),o.producerVersion!=null&&o.hasOwnProperty("producerVersion")&&(v.producerVersion=o.producerVersion),o.domain!=null&&o.hasOwnProperty("domain")&&(v.domain=o.domain),o.modelVersion!=null&&o.hasOwnProperty("modelVersion")&&(typeof o.modelVersion=="number"?v.modelVersion=c.longs===String?String(o.modelVersion):o.modelVersion:v.modelVersion=c.longs===String?f.Long.prototype.toString.call(o.modelVersion):c.longs===Number?new f.LongBits(o.modelVersion.low>>>0,o.modelVersion.high>>>0).toNumber():o.modelVersion),o.docString!=null&&o.hasOwnProperty("docString")&&(v.docString=o.docString),o.graph!=null&&o.hasOwnProperty("graph")&&(v.graph=m.onnx.GraphProto.toObject(o.graph,c)),o.opsetImport&&o.opsetImport.length){v.opsetImport=[];for(var _=0;_>>3){case 1:y.key=o.string();break;case 2:y.value=o.string();break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.key!=null&&o.hasOwnProperty("key")&&!f.isString(o.key)?"key: string expected":o.value!=null&&o.hasOwnProperty("value")&&!f.isString(o.value)?"value: string expected":null},s.fromObject=function(o){if(o instanceof m.onnx.StringStringEntryProto)return o;var c=new m.onnx.StringStringEntryProto;return o.key!=null&&(c.key=String(o.key)),o.value!=null&&(c.value=String(o.value)),c},s.toObject=function(o,c){c||(c={});var v={};return c.defaults&&(v.key="",v.value=""),o.key!=null&&o.hasOwnProperty("key")&&(v.key=o.key),o.value!=null&&o.hasOwnProperty("value")&&(v.value=o.value),v},s.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},s}(),a.TensorAnnotation=function(){function s(o){if(this.quantParameterTensorNames=[],o)for(var c=Object.keys(o),v=0;v>>3){case 1:y.tensorName=o.string();break;case 2:y.quantParameterTensorNames&&y.quantParameterTensorNames.length||(y.quantParameterTensorNames=[]),y.quantParameterTensorNames.push(m.onnx.StringStringEntryProto.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.tensorName!=null&&o.hasOwnProperty("tensorName")&&!f.isString(o.tensorName))return"tensorName: string expected";if(o.quantParameterTensorNames!=null&&o.hasOwnProperty("quantParameterTensorNames")){if(!Array.isArray(o.quantParameterTensorNames))return"quantParameterTensorNames: array expected";for(var c=0;c>>3){case 1:y.node&&y.node.length||(y.node=[]),y.node.push(m.onnx.NodeProto.decode(o,o.uint32()));break;case 2:y.name=o.string();break;case 5:y.initializer&&y.initializer.length||(y.initializer=[]),y.initializer.push(m.onnx.TensorProto.decode(o,o.uint32()));break;case 10:y.docString=o.string();break;case 11:y.input&&y.input.length||(y.input=[]),y.input.push(m.onnx.ValueInfoProto.decode(o,o.uint32()));break;case 12:y.output&&y.output.length||(y.output=[]),y.output.push(m.onnx.ValueInfoProto.decode(o,o.uint32()));break;case 13:y.valueInfo&&y.valueInfo.length||(y.valueInfo=[]),y.valueInfo.push(m.onnx.ValueInfoProto.decode(o,o.uint32()));break;case 14:y.quantizationAnnotation&&y.quantizationAnnotation.length||(y.quantizationAnnotation=[]),y.quantizationAnnotation.push(m.onnx.TensorAnnotation.decode(o,o.uint32()));break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.node!=null&&o.hasOwnProperty("node")){if(!Array.isArray(o.node))return"node: array expected";for(var c=0;c>>3){case 1:if(y.dims&&y.dims.length||(y.dims=[]),(7&_)==2)for(var b=o.uint32()+o.pos;o.pos>>0,o.dims[v].high>>>0).toNumber())}if(o.dataType!=null&&(c.dataType=0|o.dataType),o.segment!=null){if(typeof o.segment!="object")throw TypeError(".onnx.TensorProto.segment: object expected");c.segment=m.onnx.TensorProto.Segment.fromObject(o.segment)}if(o.floatData){if(!Array.isArray(o.floatData))throw TypeError(".onnx.TensorProto.floatData: array expected");for(c.floatData=[],v=0;v>>0,o.int64Data[v].high>>>0).toNumber())}if(o.name!=null&&(c.name=String(o.name)),o.docString!=null&&(c.docString=String(o.docString)),o.rawData!=null&&(typeof o.rawData=="string"?f.base64.decode(o.rawData,c.rawData=f.newBuffer(f.base64.length(o.rawData)),0):o.rawData.length&&(c.rawData=o.rawData)),o.externalData){if(!Array.isArray(o.externalData))throw TypeError(".onnx.TensorProto.externalData: array expected");for(c.externalData=[],v=0;v>>0,o.uint64Data[v].high>>>0).toNumber(!0))}return c},s.toObject=function(o,c){c||(c={});var v={};if((c.arrays||c.defaults)&&(v.dims=[],v.floatData=[],v.int32Data=[],v.stringData=[],v.int64Data=[],v.doubleData=[],v.uint64Data=[],v.externalData=[]),c.defaults&&(v.dataType=0,v.segment=null,v.name="",c.bytes===String?v.rawData="":(v.rawData=[],c.bytes!==Array&&(v.rawData=f.newBuffer(v.rawData))),v.docString="",v.dataLocation=c.enums===String?"DEFAULT":0),o.dims&&o.dims.length){v.dims=[];for(var y=0;y>>0,o.dims[y].high>>>0).toNumber():o.dims[y]}if(o.dataType!=null&&o.hasOwnProperty("dataType")&&(v.dataType=o.dataType),o.segment!=null&&o.hasOwnProperty("segment")&&(v.segment=m.onnx.TensorProto.Segment.toObject(o.segment,c)),o.floatData&&o.floatData.length)for(v.floatData=[],y=0;y>>0,o.int64Data[y].high>>>0).toNumber():o.int64Data[y];if(o.name!=null&&o.hasOwnProperty("name")&&(v.name=o.name),o.rawData!=null&&o.hasOwnProperty("rawData")&&(v.rawData=c.bytes===String?f.base64.encode(o.rawData,0,o.rawData.length):c.bytes===Array?Array.prototype.slice.call(o.rawData):o.rawData),o.doubleData&&o.doubleData.length)for(v.doubleData=[],y=0;y>>0,o.uint64Data[y].high>>>0).toNumber(!0):o.uint64Data[y];if(o.docString!=null&&o.hasOwnProperty("docString")&&(v.docString=o.docString),o.externalData&&o.externalData.length)for(v.externalData=[],y=0;y>>3){case 1:_.begin=c.int64();break;case 2:_.end=c.int64();break;default:c.skipType(7&b)}}return _},o.decodeDelimited=function(c){return c instanceof u||(c=new u(c)),this.decode(c,c.uint32())},o.verify=function(c){return typeof c!="object"||c===null?"object expected":c.begin!=null&&c.hasOwnProperty("begin")&&!(f.isInteger(c.begin)||c.begin&&f.isInteger(c.begin.low)&&f.isInteger(c.begin.high))?"begin: integer|Long expected":c.end!=null&&c.hasOwnProperty("end")&&!(f.isInteger(c.end)||c.end&&f.isInteger(c.end.low)&&f.isInteger(c.end.high))?"end: integer|Long expected":null},o.fromObject=function(c){if(c instanceof m.onnx.TensorProto.Segment)return c;var v=new m.onnx.TensorProto.Segment;return c.begin!=null&&(f.Long?(v.begin=f.Long.fromValue(c.begin)).unsigned=!1:typeof c.begin=="string"?v.begin=parseInt(c.begin,10):typeof c.begin=="number"?v.begin=c.begin:typeof c.begin=="object"&&(v.begin=new f.LongBits(c.begin.low>>>0,c.begin.high>>>0).toNumber())),c.end!=null&&(f.Long?(v.end=f.Long.fromValue(c.end)).unsigned=!1:typeof c.end=="string"?v.end=parseInt(c.end,10):typeof c.end=="number"?v.end=c.end:typeof c.end=="object"&&(v.end=new f.LongBits(c.end.low>>>0,c.end.high>>>0).toNumber())),v},o.toObject=function(c,v){v||(v={});var y={};if(v.defaults){if(f.Long){var _=new f.Long(0,0,!1);y.begin=v.longs===String?_.toString():v.longs===Number?_.toNumber():_}else y.begin=v.longs===String?"0":0;f.Long?(_=new f.Long(0,0,!1),y.end=v.longs===String?_.toString():v.longs===Number?_.toNumber():_):y.end=v.longs===String?"0":0}return c.begin!=null&&c.hasOwnProperty("begin")&&(typeof c.begin=="number"?y.begin=v.longs===String?String(c.begin):c.begin:y.begin=v.longs===String?f.Long.prototype.toString.call(c.begin):v.longs===Number?new f.LongBits(c.begin.low>>>0,c.begin.high>>>0).toNumber():c.begin),c.end!=null&&c.hasOwnProperty("end")&&(typeof c.end=="number"?y.end=v.longs===String?String(c.end):c.end:y.end=v.longs===String?f.Long.prototype.toString.call(c.end):v.longs===Number?new f.LongBits(c.end.low>>>0,c.end.high>>>0).toNumber():c.end),y},o.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},o}(),s.DataLocation=function(){var o={},c=Object.create(o);return c[o[0]="DEFAULT"]=0,c[o[1]="EXTERNAL"]=1,c}(),s}(),a.TensorShapeProto=function(){function s(o){if(this.dim=[],o)for(var c=Object.keys(o),v=0;v>>3==1?(y.dim&&y.dim.length||(y.dim=[]),y.dim.push(m.onnx.TensorShapeProto.Dimension.decode(o,o.uint32()))):o.skipType(7&_)}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){if(typeof o!="object"||o===null)return"object expected";if(o.dim!=null&&o.hasOwnProperty("dim")){if(!Array.isArray(o.dim))return"dim: array expected";for(var c=0;c>>3){case 1:b.dimValue=v.int64();break;case 2:b.dimParam=v.string();break;case 3:b.denotation=v.string();break;default:v.skipType(7&x)}}return b},o.decodeDelimited=function(v){return v instanceof u||(v=new u(v)),this.decode(v,v.uint32())},o.verify=function(v){if(typeof v!="object"||v===null)return"object expected";var y={};if(v.dimValue!=null&&v.hasOwnProperty("dimValue")&&(y.value=1,!(f.isInteger(v.dimValue)||v.dimValue&&f.isInteger(v.dimValue.low)&&f.isInteger(v.dimValue.high))))return"dimValue: integer|Long expected";if(v.dimParam!=null&&v.hasOwnProperty("dimParam")){if(y.value===1)return"value: multiple values";if(y.value=1,!f.isString(v.dimParam))return"dimParam: string expected"}return v.denotation!=null&&v.hasOwnProperty("denotation")&&!f.isString(v.denotation)?"denotation: string expected":null},o.fromObject=function(v){if(v instanceof m.onnx.TensorShapeProto.Dimension)return v;var y=new m.onnx.TensorShapeProto.Dimension;return v.dimValue!=null&&(f.Long?(y.dimValue=f.Long.fromValue(v.dimValue)).unsigned=!1:typeof v.dimValue=="string"?y.dimValue=parseInt(v.dimValue,10):typeof v.dimValue=="number"?y.dimValue=v.dimValue:typeof v.dimValue=="object"&&(y.dimValue=new f.LongBits(v.dimValue.low>>>0,v.dimValue.high>>>0).toNumber())),v.dimParam!=null&&(y.dimParam=String(v.dimParam)),v.denotation!=null&&(y.denotation=String(v.denotation)),y},o.toObject=function(v,y){y||(y={});var _={};return y.defaults&&(_.denotation=""),v.dimValue!=null&&v.hasOwnProperty("dimValue")&&(typeof v.dimValue=="number"?_.dimValue=y.longs===String?String(v.dimValue):v.dimValue:_.dimValue=y.longs===String?f.Long.prototype.toString.call(v.dimValue):y.longs===Number?new f.LongBits(v.dimValue.low>>>0,v.dimValue.high>>>0).toNumber():v.dimValue,y.oneofs&&(_.value="dimValue")),v.dimParam!=null&&v.hasOwnProperty("dimParam")&&(_.dimParam=v.dimParam,y.oneofs&&(_.value="dimParam")),v.denotation!=null&&v.hasOwnProperty("denotation")&&(_.denotation=v.denotation),_},o.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},o}(),s}(),a.TypeProto=function(){function s(c){if(c)for(var v=Object.keys(c),y=0;y>>3){case 1:_.tensorType=m.onnx.TypeProto.Tensor.decode(c,c.uint32());break;case 6:_.denotation=c.string();break;default:c.skipType(7&b)}}return _},s.decodeDelimited=function(c){return c instanceof u||(c=new u(c)),this.decode(c,c.uint32())},s.verify=function(c){if(typeof c!="object"||c===null)return"object expected";if(c.tensorType!=null&&c.hasOwnProperty("tensorType")){var v=m.onnx.TypeProto.Tensor.verify(c.tensorType);if(v)return"tensorType."+v}return c.denotation!=null&&c.hasOwnProperty("denotation")&&!f.isString(c.denotation)?"denotation: string expected":null},s.fromObject=function(c){if(c instanceof m.onnx.TypeProto)return c;var v=new m.onnx.TypeProto;if(c.tensorType!=null){if(typeof c.tensorType!="object")throw TypeError(".onnx.TypeProto.tensorType: object expected");v.tensorType=m.onnx.TypeProto.Tensor.fromObject(c.tensorType)}return c.denotation!=null&&(v.denotation=String(c.denotation)),v},s.toObject=function(c,v){v||(v={});var y={};return v.defaults&&(y.denotation=""),c.tensorType!=null&&c.hasOwnProperty("tensorType")&&(y.tensorType=m.onnx.TypeProto.Tensor.toObject(c.tensorType,v),v.oneofs&&(y.value="tensorType")),c.denotation!=null&&c.hasOwnProperty("denotation")&&(y.denotation=c.denotation),y},s.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},s.Tensor=function(){function c(v){if(v)for(var y=Object.keys(v),_=0;_>>3){case 1:b.elemType=v.int32();break;case 2:b.shape=m.onnx.TensorShapeProto.decode(v,v.uint32());break;default:v.skipType(7&x)}}return b},c.decodeDelimited=function(v){return v instanceof u||(v=new u(v)),this.decode(v,v.uint32())},c.verify=function(v){if(typeof v!="object"||v===null)return"object expected";if(v.elemType!=null&&v.hasOwnProperty("elemType")&&!f.isInteger(v.elemType))return"elemType: integer expected";if(v.shape!=null&&v.hasOwnProperty("shape")){var y=m.onnx.TensorShapeProto.verify(v.shape);if(y)return"shape."+y}return null},c.fromObject=function(v){if(v instanceof m.onnx.TypeProto.Tensor)return v;var y=new m.onnx.TypeProto.Tensor;if(v.elemType!=null&&(y.elemType=0|v.elemType),v.shape!=null){if(typeof v.shape!="object")throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");y.shape=m.onnx.TensorShapeProto.fromObject(v.shape)}return y},c.toObject=function(v,y){y||(y={});var _={};return y.defaults&&(_.elemType=0,_.shape=null),v.elemType!=null&&v.hasOwnProperty("elemType")&&(_.elemType=v.elemType),v.shape!=null&&v.hasOwnProperty("shape")&&(_.shape=m.onnx.TensorShapeProto.toObject(v.shape,y)),_},c.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},c}(),s}(),a.OperatorSetIdProto=function(){function s(o){if(o)for(var c=Object.keys(o),v=0;v>>3){case 1:y.domain=o.string();break;case 2:y.version=o.int64();break;default:o.skipType(7&_)}}return y},s.decodeDelimited=function(o){return o instanceof u||(o=new u(o)),this.decode(o,o.uint32())},s.verify=function(o){return typeof o!="object"||o===null?"object expected":o.domain!=null&&o.hasOwnProperty("domain")&&!f.isString(o.domain)?"domain: string expected":o.version!=null&&o.hasOwnProperty("version")&&!(f.isInteger(o.version)||o.version&&f.isInteger(o.version.low)&&f.isInteger(o.version.high))?"version: integer|Long expected":null},s.fromObject=function(o){if(o instanceof m.onnx.OperatorSetIdProto)return o;var c=new m.onnx.OperatorSetIdProto;return o.domain!=null&&(c.domain=String(o.domain)),o.version!=null&&(f.Long?(c.version=f.Long.fromValue(o.version)).unsigned=!1:typeof o.version=="string"?c.version=parseInt(o.version,10):typeof o.version=="number"?c.version=o.version:typeof o.version=="object"&&(c.version=new f.LongBits(o.version.low>>>0,o.version.high>>>0).toNumber())),c},s.toObject=function(o,c){c||(c={});var v={};if(c.defaults)if(v.domain="",f.Long){var y=new f.Long(0,0,!1);v.version=c.longs===String?y.toString():c.longs===Number?y.toNumber():y}else v.version=c.longs===String?"0":0;return o.domain!=null&&o.hasOwnProperty("domain")&&(v.domain=o.domain),o.version!=null&&o.hasOwnProperty("version")&&(typeof o.version=="number"?v.version=c.longs===String?String(o.version):o.version:v.version=c.longs===String?f.Long.prototype.toString.call(o.version):c.longs===Number?new f.LongBits(o.version.low>>>0,o.version.high>>>0).toNumber():o.version),v},s.prototype.toJSON=function(){return this.constructor.toObject(this,l.util.toJSONOptions)},s}(),a),r.exports=m},2100:(r,e,t)=>{r.exports=t(9482)},9482:(r,e,t)=>{var n=e;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=t(1173),n.BufferWriter=t(3155),n.Reader=t(1408),n.BufferReader=t(593),n.util=t(9693),n.rpc=t(5994),n.roots=t(5054),n.configure=i,i()},1408:(r,e,t)=>{r.exports=d;var n,i=t(9693),a=i.LongBits,l=i.utf8;function u(y,_){return RangeError("index out of range: "+y.pos+" + "+(_||1)+" > "+y.len)}function d(y){this.buf=y,this.pos=0,this.len=y.length}var f,m=typeof Uint8Array<"u"?function(y){if(y instanceof Uint8Array||Array.isArray(y))return new d(y);throw Error("illegal buffer")}:function(y){if(Array.isArray(y))return new d(y);throw Error("illegal buffer")},s=function(){return i.Buffer?function(y){return(d.create=function(_){return i.Buffer.isBuffer(_)?new n(_):m(_)})(y)}:m};function o(){var y=new a(0,0),_=0;if(!(this.len-this.pos>4)){for(;_<3;++_){if(this.pos>=this.len)throw u(this);if(y.lo=(y.lo|(127&this.buf[this.pos])<<7*_)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(127&this.buf[this.pos++])<<7*_)>>>0,y}for(;_<4;++_)if(y.lo=(y.lo|(127&this.buf[this.pos])<<7*_)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(127&this.buf[this.pos])<<28)>>>0,y.hi=(y.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return y;if(_=0,this.len-this.pos>4){for(;_<5;++_)if(y.hi=(y.hi|(127&this.buf[this.pos])<<7*_+3)>>>0,this.buf[this.pos++]<128)return y}else for(;_<5;++_){if(this.pos>=this.len)throw u(this);if(y.hi=(y.hi|(127&this.buf[this.pos])<<7*_+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}function c(y,_){return(y[_-4]|y[_-3]<<8|y[_-2]<<16|y[_-1]<<24)>>>0}function v(){if(this.pos+8>this.len)throw u(this,8);return new a(c(this.buf,this.pos+=4),c(this.buf,this.pos+=4))}d.create=s(),d.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,d.prototype.uint32=(f=4294967295,function(){if(f=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(f=(f|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(f=(f|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(f=(f|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(f=(f|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return f;if((this.pos+=5)>this.len)throw this.pos=this.len,u(this,10);return f}),d.prototype.int32=function(){return 0|this.uint32()},d.prototype.sint32=function(){var y=this.uint32();return y>>>1^-(1&y)|0},d.prototype.bool=function(){return this.uint32()!==0},d.prototype.fixed32=function(){if(this.pos+4>this.len)throw u(this,4);return c(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw u(this,4);return 0|c(this.buf,this.pos+=4)},d.prototype.float=function(){if(this.pos+4>this.len)throw u(this,4);var y=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,y},d.prototype.double=function(){if(this.pos+8>this.len)throw u(this,4);var y=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,y},d.prototype.bytes=function(){var y=this.uint32(),_=this.pos,b=this.pos+y;if(b>this.len)throw u(this,y);return this.pos+=y,Array.isArray(this.buf)?this.buf.slice(_,b):_===b?new this.buf.constructor(0):this._slice.call(this.buf,_,b)},d.prototype.string=function(){var y=this.bytes();return l.read(y,0,y.length)},d.prototype.skip=function(y){if(typeof y=="number"){if(this.pos+y>this.len)throw u(this,y);this.pos+=y}else do if(this.pos>=this.len)throw u(this);while(128&this.buf[this.pos++]);return this},d.prototype.skipType=function(y){switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=7&this.uint32())!=4;)this.skipType(y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},d._configure=function(y){n=y,d.create=s(),n._configure();var _=i.Long?"toLong":"toNumber";i.merge(d.prototype,{int64:function(){return o.call(this)[_](!1)},uint64:function(){return o.call(this)[_](!0)},sint64:function(){return o.call(this).zzDecode()[_](!1)},fixed64:function(){return v.call(this)[_](!0)},sfixed64:function(){return v.call(this)[_](!1)}})}},593:(r,e,t)=>{r.exports=a;var n=t(1408);(a.prototype=Object.create(n.prototype)).constructor=a;var i=t(9693);function a(l){n.call(this,l)}a._configure=function(){i.Buffer&&(a.prototype._slice=i.Buffer.prototype.slice)},a.prototype.string=function(){var l=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+l,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+l,this.len))},a._configure()},5054:r=>{r.exports={}},5994:(r,e,t)=>{e.Service=t(7948)},7948:(r,e,t)=>{r.exports=i;var n=t(9693);function i(a,l,u){if(typeof a!="function")throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=a,this.requestDelimited=!!l,this.responseDelimited=!!u}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function a(l,u,d,f,m){if(!f)throw TypeError("request must be specified");var s=this;if(!m)return n.asPromise(a,s,l,u,d,f);if(s.rpcImpl)try{return s.rpcImpl(l,u[s.requestDelimited?"encodeDelimited":"encode"](f).finish(),function(o,c){if(o)return s.emit("error",o,l),m(o);if(c!==null){if(!(c instanceof d))try{c=d[s.responseDelimited?"decodeDelimited":"decode"](c)}catch(v){return s.emit("error",v,l),m(v)}return s.emit("data",c,l),m(null,c)}s.end(!0)})}catch(o){return s.emit("error",o,l),void setTimeout(function(){m(o)},0)}else setTimeout(function(){m(Error("already ended"))},0)},i.prototype.end=function(a){return this.rpcImpl&&(a||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(r,e,t)=>{r.exports=i;var n=t(9693);function i(d,f){this.lo=d>>>0,this.hi=f>>>0}var a=i.zero=new i(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var l=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(d){if(d===0)return a;var f=d<0;f&&(d=-d);var m=d>>>0,s=(d-m)/4294967296>>>0;return f&&(s=~s>>>0,m=~m>>>0,++m>4294967295&&(m=0,++s>4294967295&&(s=0))),new i(m,s)},i.from=function(d){if(typeof d=="number")return i.fromNumber(d);if(n.isString(d)){if(!n.Long)return i.fromNumber(parseInt(d,10));d=n.Long.fromString(d)}return d.low||d.high?new i(d.low>>>0,d.high>>>0):a},i.prototype.toNumber=function(d){if(!d&&this.hi>>>31){var f=1+~this.lo>>>0,m=~this.hi>>>0;return f||(m=m+1>>>0),-(f+4294967296*m)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(d){return n.Long?new n.Long(0|this.lo,0|this.hi,!!d):{low:0|this.lo,high:0|this.hi,unsigned:!!d}};var u=String.prototype.charCodeAt;i.fromHash=function(d){return d===l?a:new i((u.call(d,0)|u.call(d,1)<<8|u.call(d,2)<<16|u.call(d,3)<<24)>>>0,(u.call(d,4)|u.call(d,5)<<8|u.call(d,6)<<16|u.call(d,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var d=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^d)>>>0,this.lo=(this.lo<<1^d)>>>0,this},i.prototype.zzDecode=function(){var d=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^d)>>>0,this.hi=(this.hi>>>1^d)>>>0,this},i.prototype.length=function(){var d=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,m=this.hi>>>24;return m===0?f===0?d<16384?d<128?1:2:d<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:m<128?9:10}},9693:function(r,e,t){var n=e;function i(l,u,d){for(var f=Object.keys(u),m=0;m0)},n.Buffer=function(){try{var l=n.inquire("buffer").Buffer;return l.prototype.utf8Write?l:null}catch{return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(l){return typeof l=="number"?n.Buffer?n._Buffer_allocUnsafe(l):new n.Array(l):n.Buffer?n._Buffer_from(l):typeof Uint8Array>"u"?l:new Uint8Array(l)},n.Array=typeof Uint8Array<"u"?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(l){return l?n.LongBits.from(l).toHash():n.LongBits.zeroHash},n.longFromHash=function(l,u){var d=n.LongBits.fromHash(l);return n.Long?n.Long.fromBits(d.lo,d.hi,u):d.toNumber(!!u)},n.merge=i,n.lcFirst=function(l){return l.charAt(0).toLowerCase()+l.substring(1)},n.newError=a,n.ProtocolError=a("ProtocolError"),n.oneOfGetter=function(l){for(var u={},d=0;d-1;--m)if(u[f[m]]===1&&this[f[m]]!==void 0&&this[f[m]]!==null)return f[m]}},n.oneOfSetter=function(l){return function(u){for(var d=0;d{r.exports=s;var n,i=t(9693),a=i.LongBits,l=i.base64,u=i.utf8;function d(x,w,S){this.fn=x,this.len=w,this.next=void 0,this.val=S}function f(){}function m(x){this.head=x.head,this.tail=x.tail,this.len=x.len,this.next=x.states}function s(){this.len=0,this.head=new d(f,0,0),this.tail=this.head,this.states=null}var o=function(){return i.Buffer?function(){return(s.create=function(){return new n})()}:function(){return new s}};function c(x,w,S){w[S]=255&x}function v(x,w){this.len=x,this.next=void 0,this.val=w}function y(x,w,S){for(;x.hi;)w[S++]=127&x.lo|128,x.lo=(x.lo>>>7|x.hi<<25)>>>0,x.hi>>>=7;for(;x.lo>127;)w[S++]=127&x.lo|128,x.lo=x.lo>>>7;w[S++]=x.lo}function _(x,w,S){w[S]=255&x,w[S+1]=x>>>8&255,w[S+2]=x>>>16&255,w[S+3]=x>>>24}s.create=o(),s.alloc=function(x){return new i.Array(x)},i.Array!==Array&&(s.alloc=i.pool(s.alloc,i.Array.prototype.subarray)),s.prototype._push=function(x,w,S){return this.tail=this.tail.next=new d(x,w,S),this.len+=w,this},v.prototype=Object.create(d.prototype),v.prototype.fn=function(x,w,S){for(;x>127;)w[S++]=127&x|128,x>>>=7;w[S]=x},s.prototype.uint32=function(x){return this.len+=(this.tail=this.tail.next=new v((x>>>=0)<128?1:x<16384?2:x<2097152?3:x<268435456?4:5,x)).len,this},s.prototype.int32=function(x){return x<0?this._push(y,10,a.fromNumber(x)):this.uint32(x)},s.prototype.sint32=function(x){return this.uint32((x<<1^x>>31)>>>0)},s.prototype.uint64=function(x){var w=a.from(x);return this._push(y,w.length(),w)},s.prototype.int64=s.prototype.uint64,s.prototype.sint64=function(x){var w=a.from(x).zzEncode();return this._push(y,w.length(),w)},s.prototype.bool=function(x){return this._push(c,1,x?1:0)},s.prototype.fixed32=function(x){return this._push(_,4,x>>>0)},s.prototype.sfixed32=s.prototype.fixed32,s.prototype.fixed64=function(x){var w=a.from(x);return this._push(_,4,w.lo)._push(_,4,w.hi)},s.prototype.sfixed64=s.prototype.fixed64,s.prototype.float=function(x){return this._push(i.float.writeFloatLE,4,x)},s.prototype.double=function(x){return this._push(i.float.writeDoubleLE,8,x)};var b=i.Array.prototype.set?function(x,w,S){w.set(x,S)}:function(x,w,S){for(var T=0;T>>0;if(!w)return this._push(c,1,0);if(i.isString(x)){var S=s.alloc(w=l.length(x));l.decode(x,S,0),x=S}return this.uint32(w)._push(b,w,x)},s.prototype.string=function(x){var w=u.length(x);return w?this.uint32(w)._push(u.write,w,x):this._push(c,1,0)},s.prototype.fork=function(){return this.states=new m(this),this.head=this.tail=new d(f,0,0),this.len=0,this},s.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new d(f,0,0),this.len=0),this},s.prototype.ldelim=function(){var x=this.head,w=this.tail,S=this.len;return this.reset().uint32(S),S&&(this.tail.next=x.next,this.tail=w,this.len+=S),this},s.prototype.finish=function(){for(var x=this.head.next,w=this.constructor.alloc(this.len),S=0;x;)x.fn(x.val,w,S),S+=x.len,x=x.next;return w},s._configure=function(x){n=x,s.create=o(),n._configure()}},3155:(r,e,t)=>{r.exports=a;var n=t(1173);(a.prototype=Object.create(n.prototype)).constructor=a;var i=t(9693);function a(){n.call(this)}function l(u,d,f){u.length<40?i.utf8.write(u,d,f):d.utf8Write?d.utf8Write(u,f):d.write(u,f)}a._configure=function(){a.alloc=i._Buffer_allocUnsafe,a.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&i.Buffer.prototype.set.name==="set"?function(u,d,f){d.set(u,f)}:function(u,d,f){if(u.copy)u.copy(d,f,0,u.length);else for(var m=0;m>>0;return this.uint32(d),d&&this._push(a.writeBytesBuffer,d,u),this},a.prototype.string=function(u){var d=i.Buffer.byteLength(u);return this.uint32(d),d&&this._push(l,d,u),this},a._configure()},7714:(r,e,t)=>{e.R=void 0;const n=t(6919),i=t(7448);e.R=new class{async init(){}async createSessionHandler(a,l){const u=new n.Session(l);return await u.loadModel(a),new i.OnnxjsSessionHandler(u)}}},4200:(r,e,t)=>{e.c8=e.rX=void 0;const n=t(1670),i=t(5381),a=t(2157),l=t(2306);e.rX=()=>{if((typeof n.env.wasm.initTimeout!="number"||n.env.wasm.initTimeout<0)&&(n.env.wasm.initTimeout=0),typeof n.env.wasm.simd!="boolean"&&(n.env.wasm.simd=!0),typeof n.env.wasm.proxy!="boolean"&&(n.env.wasm.proxy=!1),typeof n.env.wasm.numThreads!="number"||!Number.isInteger(n.env.wasm.numThreads)||n.env.wasm.numThreads<=0){const u=typeof navigator>"u"?(0,i.cpus)().length:navigator.hardwareConcurrency;n.env.wasm.numThreads=Math.min(4,Math.ceil((u||1)/2))}},e.c8=new class{async init(){(0,e.rX)(),await(0,a.initWasm)()}async createSessionHandler(u,d){const f=new l.OnnxruntimeWebAssemblySessionHandler;return await f.loadModel(u,d),Promise.resolve(f)}}},6018:function(r,e,t){var n=this&&this.__createBinding||(Object.create?function(l,u,d,f){f===void 0&&(f=d);var m=Object.getOwnPropertyDescriptor(u,d);m&&!("get"in m?!u.__esModule:m.writable||m.configurable)||(m={enumerable:!0,get:function(){return u[d]}}),Object.defineProperty(l,f,m)}:function(l,u,d,f){f===void 0&&(f=d),l[f]=u[d]}),i=this&&this.__exportStar||function(l,u){for(var d in l)d==="default"||Object.prototype.hasOwnProperty.call(u,d)||n(u,l,d)};Object.defineProperty(e,"__esModule",{value:!0}),i(t(1670),e);const a=t(1670);{const l=t(7714).R;(0,a.registerBackend)("webgl",l,-10)}{const l=t(4200).c8;(0,a.registerBackend)("cpu",l,10),(0,a.registerBackend)("wasm",l,10),(0,a.registerBackend)("xnnpack",l,9)}},246:(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createAttributeWithCacheKey=void 0;class t{constructor(i){Object.assign(this,i)}get cacheKey(){return this._cacheKey||(this._cacheKey=Object.getOwnPropertyNames(this).sort().map(i=>`${this[i]}`).join(";")),this._cacheKey}}e.createAttributeWithCacheKey=n=>new t(n)},7778:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Attribute=void 0;const n=t(1446),i=t(9395),a=t(9162),l=t(2517);var u=i.onnxruntime.experimental.fbs;class d{constructor(m){if(this._attributes=new Map,m!=null){for(const s of m)s instanceof n.onnx.AttributeProto?this._attributes.set(s.name,[d.getValue(s),d.getType(s)]):s instanceof u.Attribute&&this._attributes.set(s.name(),[d.getValue(s),d.getType(s)]);if(this._attributes.sizea.Tensor.fromProto(c));if(m instanceof u.Attribute)return o.map(c=>a.Tensor.fromOrtTensor(c))}if(s===n.onnx.AttributeProto.AttributeType.STRING&&m instanceof n.onnx.AttributeProto){const c=o;return(0,l.decodeUtf8String)(c)}return s===n.onnx.AttributeProto.AttributeType.STRINGS&&m instanceof n.onnx.AttributeProto?o.map(l.decodeUtf8String):o}static getValueNoCheck(m){return m instanceof n.onnx.AttributeProto?this.getValueNoCheckFromOnnxFormat(m):this.getValueNoCheckFromOrtFormat(m)}static getValueNoCheckFromOnnxFormat(m){switch(m.type){case n.onnx.AttributeProto.AttributeType.FLOAT:return m.f;case n.onnx.AttributeProto.AttributeType.INT:return m.i;case n.onnx.AttributeProto.AttributeType.STRING:return m.s;case n.onnx.AttributeProto.AttributeType.TENSOR:return m.t;case n.onnx.AttributeProto.AttributeType.GRAPH:return m.g;case n.onnx.AttributeProto.AttributeType.FLOATS:return m.floats;case n.onnx.AttributeProto.AttributeType.INTS:return m.ints;case n.onnx.AttributeProto.AttributeType.STRINGS:return m.strings;case n.onnx.AttributeProto.AttributeType.TENSORS:return m.tensors;case n.onnx.AttributeProto.AttributeType.GRAPHS:return m.graphs;default:throw new Error(`unsupported attribute type: ${n.onnx.AttributeProto.AttributeType[m.type]}`)}}static getValueNoCheckFromOrtFormat(m){switch(m.type()){case u.AttributeType.FLOAT:return m.f();case u.AttributeType.INT:return m.i();case u.AttributeType.STRING:return m.s();case u.AttributeType.TENSOR:return m.t();case u.AttributeType.GRAPH:return m.g();case u.AttributeType.FLOATS:return m.floatsArray();case u.AttributeType.INTS:{const s=[];for(let o=0;o{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveBackend=e.backend=void 0;const n=t(5038),i=new Map;async function a(l){const u=e.backend;if(u[l]!==void 0&&function(d){const f=d;return"initialize"in f&&typeof f.initialize=="function"&&"createSessionHandler"in f&&typeof f.createSessionHandler=="function"&&"dispose"in f&&typeof f.dispose=="function"}(u[l])){const d=u[l];let f=d.initialize();if(typeof f=="object"&&"then"in f&&(f=await f),f)return i.set(l,d),d}}e.backend={webgl:new n.WebGLBackend},e.resolveBackend=async function l(u){if(!u)return l(["webgl"]);{const d=typeof u=="string"?[u]:u;for(const f of d){const m=i.get(f);if(m)return m;const s=await a(f);if(s)return s}}throw new Error("no available backend to use")}},5038:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLBackend=void 0;const n=t(1670),i=t(6231),a=t(6416),l=t(7305);e.WebGLBackend=class{get contextId(){return n.env.webgl.contextId}set contextId(u){n.env.webgl.contextId=u}get matmulMaxBatchSize(){return n.env.webgl.matmulMaxBatchSize}set matmulMaxBatchSize(u){n.env.webgl.matmulMaxBatchSize=u}get textureCacheMode(){return n.env.webgl.textureCacheMode}set textureCacheMode(u){n.env.webgl.textureCacheMode=u}get pack(){return n.env.webgl.pack}set pack(u){n.env.webgl.pack=u}get async(){return n.env.webgl.async}set async(u){n.env.webgl.async=u}initialize(){try{return this.glContext=(0,l.createWebGLContext)(this.contextId),typeof this.matmulMaxBatchSize!="number"&&(this.matmulMaxBatchSize=16),typeof this.textureCacheMode!="string"&&(this.textureCacheMode="full"),typeof this.pack!="boolean"&&(this.pack=!1),typeof this.async!="boolean"&&(this.async=!1),i.Logger.setWithEnv(n.env),i.Logger.verbose("WebGLBackend",`Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${this.async}.`),!0}catch(u){return i.Logger.warning("WebGLBackend",`Unable to initialize WebGLBackend. ${u}`),!1}}createSessionHandler(u){return new a.WebGLSessionHandler(this,u)}dispose(){this.glContext.dispose()}}},5107:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CoordsGlslLib=void 0;const n=t(2517),i=t(8520),a=t(5060),l=t(7859),u=t(9390);class d extends i.GlslLib{constructor(m){super(m)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.offsetToCoords()),this.coordsToOffset()),this.toVec()),this.valueFrom()),this.getCommonUtilFuncs()),this.getInputsSamplingSnippets()),this.getOutputSamplingSnippet())}getCustomTypes(){return{}}offsetToCoords(){return{offsetToCoords:new i.GlslLibRoutine(` - vec2 offsetToCoords(int offset, int width, int height) { - int t = offset / width; - int s = offset - t*width; - vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height); - return coords; - } - `)}}coordsToOffset(){return{coordsToOffset:new i.GlslLibRoutine(` - int coordsToOffset(vec2 coords, int width, int height) { - float s = coords.s * float(width); - float t = coords.t * float(height); - int offset = int(t) * width + int(s); - return offset; - } - `)}}getOutputSamplingSnippet(){const m=this.context.outputTextureLayout;return m.isPacked?this.getPackedOutputSamplingSnippet(m):this.getUnpackedOutputSamplingSnippet(m)}getPackedOutputSamplingSnippet(m){const s=m.unpackedShape,o=[m.width,m.height],c={},v="getOutputCoords";switch(s.length){case 0:c[v]=this.getOutputScalarCoords();break;case 1:c[v]=this.getOutputPacked1DCoords(s,o);break;case 2:c[v]=this.getOutputPacked2DCoords(s,o);break;case 3:c[v]=this.getOutputPacked3DCoords(s,o);break;default:c[v]=this.getOutputPackedNDCoords(s,o)}const y=` - void setOutput(vec4 val) { - ${(0,a.getGlsl)(this.context.glContext.version).output} = val; - } - `;return c.floatTextureSetRGBA=new i.GlslLibRoutine(y),c}getUnpackedOutputSamplingSnippet(m){const s=m.unpackedShape,o=[m.width,m.height],c={},v="getOutputCoords";switch(s.length){case 0:c[v]=this.getOutputScalarCoords();break;case 1:c[v]=this.getOutputUnpacked1DCoords(s,o);break;case 2:c[v]=this.getOutputUnpacked2DCoords(s,o);break;case 3:c[v]=this.getOutputUnpacked3DCoords(s,o);break;case 4:c[v]=this.getOutputUnpacked4DCoords(s,o);break;case 5:c[v]=this.getOutputUnpacked5DCoords(s,o);break;case 6:c[v]=this.getOutputUnpacked6DCoords(s,o);break;default:throw new Error(`Unsupported output dimensionality: ${s.length}`)}const y=` - void setOutput(float val) { - ${(0,a.getGlsl)(this.context.glContext.version).output} = vec4(val, 0, 0, 0); - } - `;return c.floatTextureSetR=new i.GlslLibRoutine(y),c}getOutputScalarCoords(){return new i.GlslLibRoutine(` - int getOutputCoords() { - return 0; - } - `)}getOutputPacked1DCoords(m,s){const o=s;let c="";return o[0]===1?(c=` - int getOutputCoords() { - return 2 * int(TexCoords.y * ${o[1]}.0); - } - `,new i.GlslLibRoutine(c)):o[1]===1?(c=` - int getOutputCoords() { - return 2 * int(TexCoords.x * ${o[0]}.0); - } - `,new i.GlslLibRoutine(c)):(c=` - int getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${o[0]}, ${o[1]})); - return 2 * (resTexRC.y * ${o[0]} + resTexRC.x); - } - `,new i.GlslLibRoutine(c))}getOutputPacked2DCoords(m,s){let o="";if(n.ArrayUtil.arraysEqual(m,s))return o=` - ivec2 getOutputCoords() { - return 2 * ivec2(TexCoords.xy * vec2(${s[0]}, ${s[1]})); - } - `,new i.GlslLibRoutine(o);const c=s,v=Math.ceil(m[1]/2);return o=` - ivec2 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${c[0]}, ${c[1]})); - - int index = resTexRC.y * ${c[0]} + resTexRC.x; - - // reverse r and c order for packed texture - int r = imod(index, ${v}) * 2; - int c = 2 * (index / ${v}); - - return ivec2(r, c); - } - `,new i.GlslLibRoutine(o)}getOutputPacked3DCoords(m,s){const o=[s[0],s[1]],c=Math.ceil(m[2]/2),v=c*Math.ceil(m[1]/2),y=` - ivec3 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${o[0]}, ${o[1]})); - int index = resTexRC.y * ${o[0]} + resTexRC.x; - - int b = index / ${v}; - index -= b * ${v}; - - // reverse r and c order for packed texture - int r = imod(index, ${c}) * 2; - int c = 2 * (index / ${c}); - - return ivec3(b, r, c); - } - `;return new i.GlslLibRoutine(y)}getOutputPackedNDCoords(m,s){const o=[s[0],s[1]],c=Math.ceil(m[m.length-1]/2),v=c*Math.ceil(m[m.length-2]/2);let y=v,_="",b="b, r, c";for(let w=2;w=0;--b)v[b]=v[b+1]*m[b+1];const y=["r","c","d"],_=v.map((b,x)=>`int ${y[x]} = index / ${b}; ${x===v.length-1?`int ${y[x+1]} = index - ${y[x]} * ${b}`:`index -= ${y[x]} * ${b}`};`).join("");return o=` - ivec3 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${s[0]}, ${s[1]})); - int index = resTexRC.y * ${s[0]} + resTexRC.x; - ${_} - return ivec3(r, c, d); - } - `,new i.GlslLibRoutine(o)}getOutputUnpacked4DCoords(m,s){let o="";const c=m.length;let v=null;c<2&&(v=[]),v=new Array(c-1),v[c-2]=m[c-1];for(let b=c-3;b>=0;--b)v[b]=v[b+1]*m[b+1];const y=["r","c","d","d2"],_=v.map((b,x)=>`int ${y[x]} = index / ${b}; ${x===v.length-1?`int ${y[x+1]} = index - ${y[x]} * ${b}`:`index -= ${y[x]} * ${b}`};`).join("");return o=` - ivec4 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${s[0]}, ${s[1]})); - int index = resTexRC.y * ${s[0]} + resTexRC.x; - ${_} - return ivec4(r, c, d, d2); - } - `,new i.GlslLibRoutine(o)}getOutputUnpacked5DCoords(m,s){let o="";const c=m.length;let v=null;c<2&&(v=[]),v=new Array(c-1),v[c-2]=m[c-1];for(let b=c-3;b>=0;--b)v[b]=v[b+1]*m[b+1];const y=["r","c","d","d2","d3"],_=v.map((b,x)=>`int ${y[x]} = index / ${b}; ${x===v.length-1?`int ${y[x+1]} = index - ${y[x]} * ${b}`:`index -= ${y[x]} * ${b}`};`).join("");return o=` - ivec5 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${s[0]}, ${s[1]})); - int index = resTexRC.y * ${s[0]} + resTexRC.x; - ${_} - return ivec5(r, c, d, d2, d3); - } - `,new i.GlslLibRoutine(o)}getOutputUnpacked6DCoords(m,s){let o="";const c=m.length;let v=null;c<2&&(v=[]),v=new Array(c-1),v[c-2]=m[c-1];for(let b=c-3;b>=0;--b)v[b]=v[b+1]*m[b+1];const y=["r","c","d","d2","d3","d4"],_=v.map((b,x)=>`int ${y[x]} = index / ${b}; ${x===v.length-1?`int ${y[x+1]} = index - ${y[x]} * ${b}`:`index -= ${y[x]} * ${b}`};`).join("");return o=` - ivec6 getOutputCoords() { - ivec2 resTexRC = ivec2(TexCoords.xy * - vec2(${s[0]}, ${s[1]})); - int index = resTexRC.y * ${s[0]} + resTexRC.x; - ${_} - return ivec6(r, c, d, d2, d3, d4); - } - `,new i.GlslLibRoutine(o)}getCommonUtilFuncs(){const m={};let s="uvFromFlat";m[s]=new i.GlslLibRoutine(` - vec2 uvFromFlat(int texNumR, int texNumC, int index) { - int texC = index / texNumR; - int texR = index - texC * texNumR; - // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to - // v. - return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC); - } - `),s="packedUVfrom1D",m[s]=new i.GlslLibRoutine(` - vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { - int texelIndex = index / 2; - int texR = texelIndex / texNumC; - int texC = texelIndex - texR * texNumC; - return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); - } - `),s="packedUVfrom2D",m[s]=new i.GlslLibRoutine(` - vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) { - int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); - int texR = texelIndex / texNumC; - int texC = texelIndex - texR * texNumC; - return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); - } - `),s="packedUVfrom3D",m[s]=new i.GlslLibRoutine(` - vec2 packedUVfrom3D(int texNumR, int texNumC, - int texelsInBatch, int texelsInLogicalRow, int b, - int row, int col) { - int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2); - int texR = index / texNumC; - int texC = index - texR * texNumC; - return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); - } - `),s="sampleTexture";const o=(0,a.getGlsl)(this.context.glContext.version);return m[s]=new i.GlslLibRoutine(` - float sampleTexture(sampler2D textureSampler, vec2 uv) { - return ${o.texture2D}(textureSampler, uv).r; - }`),m}getInputsSamplingSnippets(){const m={},s=this.context.outputTextureLayout;return this.context.programInfo.inputNames.forEach((o,c)=>{const v=this.context.inputTextureLayouts[c],y=(0,u.generateShaderFuncNameFromInputSamplerName)(o);v.isPacked?m[y]=this.getPackedSamplerFromInput(y,o,v):m[y]=this.getUnpackedSamplerFromInput(y,o,v);const _=(0,u.generateShaderFuncNameFromInputSamplerNameAtOutCoords)(o);v.unpackedShape.length<=s.unpackedShape.length&&(v.isPacked?m[_]=this.getPackedSamplerAtOutputCoords(_,v,s,o):m[_]=this.getUnpackedSamplerAtOutputCoords(_,v,s,o))}),m}getPackedSamplerAtOutputCoords(m,s,o,c){const v=s.unpackedShape,y=o.unpackedShape,_=c,b=(0,u.generateShaderFuncNameFromInputSamplerName)(_),x=v.length,w=y.length,S=n.BroadcastUtil.getBroadcastDims(v,y),T=(0,u.getCoordsDataType)(w),E=w-x;let M;const P=(0,u.getGlChannels)();M=x===0?"":w<2&&S.length>=1?"coords = 0;":S.map(I=>`coords.${P[I+E]} = 0;`).join(` -`);let A="";A=w<2&&x>0?"coords":v.map((I,W)=>`coords.${P[W+E]}`).join(", ");let C="return outputValue;";const D=n.ShapeUtil.size(v)===1,k=n.ShapeUtil.size(y)===1;if(x!==1||D||k){if(D&&!k)C=w===1?` - return vec4(outputValue.x, outputValue.x, 0., 0.); - `:` - return vec4(outputValue.x); - `;else if(S.length){const I=x-2,W=x-1;S.indexOf(I)>-1&&S.indexOf(W)>-1?C="return vec4(outputValue.x);":S.indexOf(I)>-1?C="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":S.indexOf(W)>-1&&(C="return vec4(outputValue.xx, outputValue.zz);")}}else C=` - return vec4(outputValue.xy, outputValue.xy); - `;const j=` - vec4 ${m}() { - ${T} coords = getOutputCoords(); - - int lastDim = coords.${P[w-1]}; - coords.${P[w-1]} = coords.${P[w-2]}; - coords.${P[w-2]} = lastDim; - - ${M} - vec4 outputValue = ${b}(${A}); - ${C} - } - `;return new i.GlslLibRoutine(j,["coordinates.getOutputCoords"])}getUnpackedSamplerAtOutputCoords(m,s,o,c){const v=[o.width,o.height],y=[s.width,s.height],_=s.unpackedShape.length,b=o.unpackedShape.length,x=s.unpackedShape,w=o.unpackedShape,S=(0,u.generateShaderFuncNameFromInputSamplerName)(c);if(_===b&&n.ArrayUtil.arraysEqual(y,v)){const k=` - float ${m}() { - return sampleTexture(${c}, TexCoords); - } - `;return new i.GlslLibRoutine(k,["coordinates.sampleTexture"])}const T=(0,u.getCoordsDataType)(b),E=n.BroadcastUtil.getBroadcastDims(x,w),M=b-_;let P;const A=(0,u.getGlChannels)();P=_===0?"":b<2&&E.length>=1?"coords = 0;":E.map(k=>`coords.${A[k+M]} = 0;`).join(` -`);let C="";C=b<2&&_>0?"coords":s.unpackedShape.map((k,j)=>`coords.${A[j+M]}`).join(", ");const D=` - float ${m}() { - ${T} coords = getOutputCoords(); - ${P} - return ${S}(${C}); - } - `;return new i.GlslLibRoutine(D,["coordinates.getOutputCoords"])}getPackedSamplerFromInput(m,s,o){switch(o.unpackedShape.length){case 0:return this.getPackedSamplerScalar(m,s);case 1:return this.getPackedSampler1D(m,s,o);case 2:return this.getPackedSampler2D(m,s,o);case 3:return this.getPackedSampler3D(m,s,o);default:return this.getPackedSamplerND(m,s,o)}}getUnpackedSamplerFromInput(m,s,o){const c=o.unpackedShape;switch(c.length){case 0:return this.getUnpackedSamplerScalar(m,s,o);case 1:return this.getUnpackedSampler1D(m,s,o);case 2:return this.getUnpackedSampler2D(m,s,o);case 3:return this.getUnpackedSampler3D(m,s,o);case 4:return this.getUnpackedSampler4D(m,s,o);case 5:return this.getUnpackedSampler5D(m,s,o);case 6:return this.getUnpackedSampler6D(m,s,o);default:throw new Error(`Unsupported dimension ${c.length}-D`)}}getPackedSamplerScalar(m,s){const o=` - vec4 ${m}() { - return ${(0,a.getGlsl)(this.context.glContext.version).texture2D}(${s}, halfCR); - } - `;return new i.GlslLibRoutine(o)}getPackedSampler1D(m,s,o){const c=[o.width,o.height],v=[c[1],c[0]],y=(0,a.getGlsl)(this.context.glContext.version),_=`vec4 ${m}(int index) { - vec2 uv = packedUVfrom1D( - ${v[0]}, ${v[1]}, index); - return ${y.texture2D}(${s}, uv); - }`;return new i.GlslLibRoutine(_,["coordinates.packedUVfrom1D"])}getPackedSampler2D(m,s,o){const c=o.unpackedShape,v=[o.width,o.height],y=(0,a.getGlsl)(this.context.glContext.version),_=v[0],b=v[1];if(v!=null&&n.ArrayUtil.arraysEqual(c,v)){const T=`vec4 ${m}(int row, int col) { - vec2 uv = (vec2(col, row) + halfCR) / vec2(${b}.0, ${_}.0); - return ${y.texture2D}(${s}, uv); - }`;return new i.GlslLibRoutine(T)}const x=v,w=Math.ceil(c[1]/2),S=`vec4 ${m}(int row, int col) { - vec2 uv = packedUVfrom2D(${x[1]}, ${x[0]}, ${w}, row, col); - return ${y.texture2D}(${s}, uv); - }`;return new i.GlslLibRoutine(S,["coordinates.packedUVfrom2D"])}getPackedSampler3D(m,s,o){const c=o.unpackedShape,v=[o.width,o.height],y=[v[0],v[1]],_=(0,a.getGlsl)(this.context.glContext.version);if(c[0]===1){const T=c.slice(1),E=[1,2],M=(0,u.squeezeInputShape)(c,T),P=["b","row","col"],A=JSON.parse(JSON.stringify(o));A.unpackedShape=M;const C=this.getPackedSamplerFromInput(m,s,A),D=`${C.routineBody} - vec4 ${m}(int b, int row, int col) { - return ${m}(${(0,u.getSqueezedParams)(P,E)}); - } `;return new i.GlslLibRoutine(D,C.dependencies)}const b=y[0],x=y[1],w=Math.ceil(c[2]/2),S=`vec4 ${m}(int b, int row, int col) { - vec2 uv = packedUVfrom3D( - ${x}, ${b}, ${w*Math.ceil(c[1]/2)}, ${w}, b, row, col); - return ${_.texture2D}(${s}, uv);}`;return new i.GlslLibRoutine(S,["coordinates.packedUVfrom3D"])}getPackedSamplerND(m,s,o){const c=o.unpackedShape,v=c.length,y=[o.width,o.height],_=(0,a.getGlsl)(this.context.glContext.version),b=[y[0],y[1]],x=b[1],w=b[0],S=Math.ceil(c[v-1]/2);let T=S*Math.ceil(c[v-2]/2),E="int b, int row, int col",M=`b * ${T} + (row / 2) * ${S} + (col / 2)`;for(let A=2;A{const c=this.context.inputTextureLayouts[o],v=(c.unpackedShape.length>0?c.unpackedShape:c.shape).length;let y=`_${s}`;m[y]=new i.GlslLibRoutine(this.getValueFromSingle(s,v,c.width,c.height,!1),[`shapeUtils.indicesToOffset${y}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"]),y+="_T",m[y]=new i.GlslLibRoutine(this.getValueFromSingle(s,v,c.width,c.height,!0),[`shapeUtils.indicesToOffset${y}`,"coordinates.offsetToCoords","fragcolor.getColorAsFloat"])}),m}getValueFromSingle(m,s,o,c,v){let y=`_${m}`;return v&&(y+="_T"),` - float ${y}(int m[${s}]) { - int offset = indicesToOffset${y}(m); - vec2 coords = offsetToCoords(offset, ${o}, ${c}); - float value = getColorAsFloat(${(0,a.getGlsl)(this.context.glContext.version).texture2D}(${m}, coords)); - return value; - } - `}getPackedValueFrom(m,s,o,c,v){let y=`_${m}_Pack`;return v&&(y+="_T"),` - vec4 ${y}(int m[${s}]) { - int offset = indicesToOffset_${m}(m); - vec2 coords = offsetToCoords(offset, ${o}, ${c}); - return ${(0,a.getGlsl)(this.context.glContext.version).texture2D}(${m}, coords); - } - `}}e.CoordsGlslLib=d},8520:(r,e)=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TopologicalSortGlslRoutines=e.GlslLibRoutineNode=e.GlslLibRoutine=e.GlslLib=e.GlslContext=e.FunctionType=void 0,(t=e.FunctionType||(e.FunctionType={}))[t.ValueBased=0]="ValueBased",t[t.Positional=1]="Positional",e.GlslContext=class{constructor(n,i,a,l){this.glContext=n,this.programInfo=i,this.inputTextureLayouts=a,this.outputTextureLayout=l}},e.GlslLib=class{constructor(n){this.context=n}},e.GlslLibRoutine=class{constructor(n,i){this.routineBody=n,this.dependencies=i}},e.GlslLibRoutineNode=class{constructor(n,i,a){this.name=n,this.dependencies=a||[],i&&(this.routineBody=i)}addDependency(n){n&&this.dependencies.push(n)}},e.TopologicalSortGlslRoutines=class{static returnOrderedNodes(n){if(!n||n.length===0)return[];if(n.length===1)return n;const i=new Set,a=new Set,l=new Array;return this.createOrderedNodes(n,i,a,l),l}static createOrderedNodes(n,i,a,l){for(let u=0;u0)for(let d=0;d{Object.defineProperty(e,"__esModule",{value:!0}),e.EncodingGlslLib=void 0;const n=t(8520);class i extends n.GlslLib{constructor(l){super(l)}getFunctions(){return Object.assign(Object.assign({},this.encodeFloat32()),this.decodeFloat32())}getCustomTypes(){return{}}encodeFloat32(){return{encode:new n.GlslLibRoutine(`highp vec4 encode(highp float f) { - return vec4(f, 0.0, 0.0, 0.0); - } - `)}}decodeFloat32(){return{decode:new n.GlslLibRoutine(`highp float decode(highp vec4 rgba) { - return rgba.r; - } - `)}}encodeUint8(){const l=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{encode:new n.GlslLibRoutine(` - highp vec4 encode(highp float f) { - highp float F = abs(f); - highp float Sign = step(0.0,-f); - highp float Exponent = floor(log2(F)); - highp float Mantissa = (exp2(- Exponent) * F); - Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa)); - highp vec4 rgba; - rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0)); - rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0); - rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0))); - rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0))); - ${l} - rgba = rgba / 255.0; // values need to be normalized to [0,1] - return rgba; - } - `)}}decodeUint8(){const l=i.isLittleEndian()?"rgba.rgba=rgba.abgr;":"";return{decode:new n.GlslLibRoutine(` - highp float decode(highp vec4 rgba) { - rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255] - ${l} - highp float Sign = 1.0 - step(128.0,rgba[0])*2.0; - highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0; - highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000); - highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 )); - return Result; - } - `)}}static isLittleEndian(){const l=new ArrayBuffer(4),u=new Uint32Array(l),d=new Uint8Array(l);if(u[0]=3735928559,d[0]===239)return!0;if(d[0]===222)return!1;throw new Error("unknown endianness")}}e.EncodingGlslLib=i},9894:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FragColorGlslLib=void 0;const n=t(8520),i=t(5060);class a extends n.GlslLib{constructor(u){super(u)}getFunctions(){return Object.assign(Object.assign({},this.setFragColor()),this.getColorAsFloat())}getCustomTypes(){return{}}setFragColor(){const u=(0,i.getGlsl)(this.context.glContext.version);return{setFragColor:new n.GlslLibRoutine(` - void setFragColor(float value) { - ${u.output} = encode(value); - } - `,["encoding.encode"])}}getColorAsFloat(){return{getColorAsFloat:new n.GlslLibRoutine(` - float getColorAsFloat(vec4 color) { - return decode(color); - } - `,["encoding.decode"])}}}e.FragColorGlslLib=a},2848:(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.replaceInlines=void 0;const t=/@inline[\s\n\r]+(\w+)[\s\n\r]+([0-9a-zA-Z_]+)\s*\(([^)]*)\)\s*{(([^}]|[\n\r])*)}/gm;e.replaceInlines=function(n){const i={};let a;for(;(a=t.exec(n))!==null;){const l=a[3].split(",").map(u=>{const d=u.trim().split(" ");return d&&d.length===2?{type:d[0],name:d[1]}:null}).filter(u=>u!==null);i[a[2]]={params:l,body:a[4]}}for(const l in i){const u="(\\w+)?\\s+([_0-9a-zA-Z]+)\\s+=\\s+__FUNC__\\((.*)\\)\\s*;".replace("__FUNC__",l),d=new RegExp(u,"gm");for(;(a=d.exec(n))!==null;){const f=a[1],m=a[2],s=a[3].split(","),o=f?`${f} ${m};`:"";let c=i[l].body,v="";i[l].params.forEach((_,b)=>{_&&(v+=`${_.type} ${_.name} = ${s[b]}; -`)}),c=`${v} - ${c}`,c=c.replace("return",`${m} = `);const y=` - ${o} - { - ${c} - } - `;n=n.replace(a[0],y)}}return n.replace(t,"")}},8879:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlslPreprocessor=void 0;const n=t(8520),i=t(2848),a=t(5483),l=t(5060);e.GlslPreprocessor=class{constructor(u,d,f,m){this.libs={},this.glslLibRoutineDependencyGraph={},this.context=new n.GlslContext(u,d,f,m),Object.keys(a.glslRegistry).forEach(o=>{const c=new a.glslRegistry[o](this.context);this.libs[o]=c});const s=this.glslLibRoutineDependencyGraph;for(const o in this.libs){const c=this.libs[o].getFunctions();for(const v in c){const y=o+"."+v;let _;s[y]?(_=s[y],_.routineBody=c[v].routineBody):(_=new n.GlslLibRoutineNode(y,c[v].routineBody),s[y]=_);const b=c[v].dependencies;if(b)for(let x=0;x{const m=f.split(".")[1];u.indexOf(m)!==-1&&d.push(this.glslLibRoutineDependencyGraph[f])}),n.TopologicalSortGlslRoutines.returnOrderedNodes(d)}getUniforms(u,d){const f=[];if(u)for(const m of u)f.push(`uniform sampler2D ${m};`);if(d)for(const m of d)f.push(`uniform ${m.type} ${m.name}${m.arrayLength?`[${m.arrayLength}]`:""};`);return f.join(` -`)}}},5483:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.glslRegistry=void 0;const n=t(5107),i=t(7341),a=t(9894),l=t(2655),u=t(3891);e.glslRegistry={encoding:i.EncodingGlslLib,fragcolor:a.FragColorGlslLib,vec:u.VecGlslLib,shapeUtils:l.ShapeUtilsGlslLib,coordinates:n.CoordsGlslLib}},2655:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ShapeUtilsGlslLib=void 0;const n=t(8520);class i extends n.GlslLib{constructor(l){super(l)}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.bcastIndex()),this.bcastMatmulIndex()),this.offsetToIndices()),this.indicesToOffset()),this.incrementIndices())}getCustomTypes(){return{}}bcastIndex(){const l=this.context.outputTextureLayout.shape.length,u={};return this.context.programInfo.inputNames.forEach((d,f)=>{const m=this.context.inputTextureLayouts[f].unpackedShape;if(m.length<=l){const s=m.length,o=l-s,c=`bcastIndices_${d}`;let v="";for(let _=0;_{const m=this.context.inputTextureLayouts[f].shape;if(!(m.length<2||m.length>l)){const s=m.length,o=l-s,c=`bcastMatmulIndices_${d}`;let v="";for(let _=0;_{const f=this.context.inputTextureLayouts[d].shape,m=this.context.inputTextureLayouts[d].strides,s=f.length;let o=`indicesToOffset_${u}`;l[o]=new n.GlslLibRoutine(i.indexToOffsetSingle(o,s,m)),o=`indicesToOffset_${u}_T`,l[o]=new n.GlslLibRoutine(i.indexToOffsetSingle(o,s,m.slice().reverse()))}),l}static indexToOffsetSingle(l,u,d){let f="";for(let m=u-1;m>=0;--m)f+=` - offset += indices[${m}] * ${d[m]}; - `;return` - int ${l}(int indices[${u}]) { - int offset = 0; - ${f} - return offset; - } - `}offsetToIndices(){const l={};return this.context.programInfo.inputNames.forEach((u,d)=>{const f=this.context.inputTextureLayouts[d].shape,m=this.context.inputTextureLayouts[d].strides,s=f.length;let o=`offsetToIndices_${u}`;l[o]=new n.GlslLibRoutine(i.offsetToIndicesSingle(o,s,m)),o=`offsetToIndices_${u}_T`,l[o]=new n.GlslLibRoutine(i.offsetToIndicesSingle(o,s,m.slice().reverse()))}),l}static offsetToIndicesSingle(l,u,d){const f=[];for(let m=0;m{const f=this.context.inputTextureLayouts[d].shape,m=f.length,s=`incrementIndices_${u}`;let o="";for(let v=0;v= 0; --i) { - if(i > axis) continue; - indices[i] += 1; - if(indices[i] < shape[i]) { - break; - } - indices[i] = 0; - } - } - `;l[s]=new n.GlslLibRoutine(c)}),l}}e.ShapeUtilsGlslLib=i},5060:(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDefaultFragShaderMain=e.getFragShaderPreamble=e.getVertexShaderSource=e.getGlsl=void 0;const t={version:"",attribute:"attribute",varyingVertex:"varying",varyingFrag:"varying",texture2D:"texture2D",output:"gl_FragColor",outputDeclaration:""},n={version:"#version 300 es",attribute:"in",varyingVertex:"out",varyingFrag:"in",texture2D:"texture",output:"outputColor",outputDeclaration:"out vec4 outputColor;"};function i(a){return a===1?t:n}e.getGlsl=i,e.getVertexShaderSource=function(a){const l=i(a);return`${l.version} - precision highp float; - ${l.attribute} vec3 position; - ${l.attribute} vec2 textureCoord; - - ${l.varyingVertex} vec2 TexCoords; - - void main() - { - gl_Position = vec4(position, 1.0); - TexCoords = textureCoord; - }`},e.getFragShaderPreamble=function(a){const l=i(a);return`${l.version} - precision highp float; - precision highp int; - precision highp sampler2D; - ${l.varyingFrag} vec2 TexCoords; - ${l.outputDeclaration} - const vec2 halfCR = vec2(0.5, 0.5); - - // Custom vector types to handle higher dimenalities. - struct ivec5 - { - int x; - int y; - int z; - int w; - int u; - }; - - struct ivec6 - { - int x; - int y; - int z; - int w; - int u; - int v; - }; - - int imod(int x, int y) { - return x - y * (x / y); - } - - `},e.getDefaultFragShaderMain=function(a,l){return` - void main() { - int indices[${l}]; - toVec(TexCoords, indices); - vec4 result = vec4(process(indices)); - ${i(a).output} = result; - } - `}},3891:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VecGlslLib=void 0;const n=t(8520);class i extends n.GlslLib{constructor(l){super(l)}getCustomTypes(){return{}}getFunctions(){return Object.assign(Object.assign(Object.assign(Object.assign({},this.binaryVecFunctions()),this.copyVec()),this.setVecItem()),this.getVecItem())}binaryVecFunctions(){const l=this.context.outputTextureLayout.shape.length,u={add:"+=",sub:"-=",mul:"*=",div:"/="},d={};for(const f in u){const m=`${f}Vec`;let s="";for(let c=0;c{Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLInferenceHandler=void 0;const n=t(6231),i=t(9162),a=t(2517),l=t(2403),u=t(7019),d=t(8710),f=t(5611),m=t(4057),s=t(2039);e.WebGLInferenceHandler=class{constructor(o){this.session=o,this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map}calculateTextureWidthAndHeight(o,c){return(0,m.calculateTextureWidthAndHeight)(this.session.layoutStrategy,o,c)}executeProgram(o,c){if(c.length{const E=T.map(P=>`${P.unpackedShape.join(",")};${P.width}x${P.height}`).join("_");let M=S.name;return S.cacheHint&&(M+="["+S.cacheHint+"]"),M+=":"+E,M})(o,v);let _=this.session.programManager.getArtifact(y);const b=_?_.programInfo:typeof o.get=="function"?o.get():o,x=(0,m.createTextureLayoutFromTextureType)(this.session.layoutStrategy,b.output.dims,b.output.textureType),w=this.createTextureData(x,b.output.type);return _||(_=this.session.programManager.build(b,v,w),this.session.programManager.setArtifact(y,_)),this.runProgram(_,v,w),w}run(o,c){return this.executeProgram(o,c).tensor}runProgram(o,c,v){for(let y=0;ythis.readTexture(b),async x=>this.readTextureAsync(b),void 0,_),texture:v});return this.setTextureData(b.tensor.dataId,b,o.isPacked),b}getTextureData(o,c=!1){return this.session.isInitializer(o)?this.session.getTextureData(o,c):c?this.packedTextureDataCache.get(o):this.unpackedTextureDataCache.get(o)}setTextureData(o,c,v=!1){this.session.isInitializer(o)?this.session.setTextureData(o,c,v):(v?this.packedTextureDataCache:this.unpackedTextureDataCache).set(o,c)}isTextureLayoutCached(o,c=!1){return!!this.getTextureData(o.dataId,c)}dispose(){this.session.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(o=>this.session.textureManager.releaseTexture(o)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(o=>this.session.textureManager.releaseTexture(o)),this.unpackedTextureDataCache=new Map}readTexture(o){return o.isPacked?this.readTexture(this.unpack(o)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTexture(o,o.tensor.type,o.channels):this.session.textureManager.readUint8TextureAsFloat((0,d.encodeAsUint8)(this,o))}async readTextureAsync(o){return o.isPacked?this.readTextureAsync(this.unpack(o)):this.session.backend.glContext.isFloat32DownloadSupported?this.session.textureManager.readTextureAsync(o,o.tensor.type,o.channels):this.session.textureManager.readUint8TextureAsFloat((0,d.encodeAsUint8)(this,o))}pack(o){return this.executeProgram((0,l.createPackProgramInfoLoader)(this,o.tensor),[o.tensor])}unpack(o){return this.executeProgram((0,f.createUnpackProgramInfoLoader)(this,o.tensor),[o.tensor])}}},1640:function(r,e,t){var n=this&&this.__createBinding||(Object.create?function(Y,B,X,Z){Z===void 0&&(Z=X);var z=Object.getOwnPropertyDescriptor(B,X);z&&!("get"in z?!B.__esModule:z.writable||z.configurable)||(z={enumerable:!0,get:function(){return B[X]}}),Object.defineProperty(Y,Z,z)}:function(Y,B,X,Z){Z===void 0&&(Z=X),Y[Z]=B[X]}),i=this&&this.__setModuleDefault||(Object.create?function(Y,B){Object.defineProperty(Y,"default",{enumerable:!0,value:B})}:function(Y,B){Y.default=B}),a=this&&this.__importStar||function(Y){if(Y&&Y.__esModule)return Y;var B={};if(Y!=null)for(var X in Y)X!=="default"&&Object.prototype.hasOwnProperty.call(Y,X)&&n(B,Y,X);return i(B,Y),B};Object.defineProperty(e,"__esModule",{value:!0}),e.WEBGL_OP_RESOLVE_RULES=void 0;const l=t(2898),u=a(t(7839)),d=t(4196),f=t(2069),m=t(8138),s=t(9663),o=t(5193),c=t(7992),v=t(1253),y=t(4776),_=t(6572),b=t(3346),x=t(5623),w=t(2870),S=t(2143),T=t(4939),E=t(718),M=t(2268),P=t(8117),A=t(2278),C=t(5524),D=t(5975),k=t(3933),j=t(6558),I=t(5723),W=t(3738),L=a(t(4909)),U=t(8428),H=t(9793);e.WEBGL_OP_RESOLVE_RULES=[["Abs","","6+",L.abs],["Acos","","7+",L.acos],["Add","","7+",u.add],["And","","7+",u.and],["Asin","","7+",L.asin],["Atan","","7+",L.atan],["AveragePool","","7+",S.averagePool,S.parseAveragePoolAttributes],["BatchNormalization","","7+",l.batchNormalization,l.parseBatchNormalizationAttributes],["Cast","","6+",d.cast,d.parseCastAttributes],["Ceil","","6+",L.ceil],["Clip","","6-10",L.clip,L.parseClipAttributes],["Clip","","11+",L.clipV11],["Concat","","4+",f.concat,f.parseConcatAttributes],["Conv","","1+",m.conv,m.parseConvAttributes],["ConvTranspose","","1+",s.convTranspose,s.parseConvTransposeAttributes],["Cos","","7+",L.cos],["Div","","7+",u.div],["Dropout","","7+",L.identity],["DepthToSpace","","1+",o.depthToSpace,o.parseDepthToSpaceAttributes],["Equal","","7+",u.equal],["Elu","","6+",L.elu,L.parseEluAttributes],["Exp","","6+",L.exp],["Flatten","","1+",c.flatten,c.parseFlattenAttributes],["Floor","","6+",L.floor],["FusedConv","com.microsoft","1+",m.conv,m.parseConvAttributes],["Gather","","1+",v.gather,v.parseGatherAttributes],["Gemm","","7-10",y.gemm,y.parseGemmAttributesV7],["Gemm","","11+",y.gemm,y.parseGemmAttributesV11],["GlobalAveragePool","","1+",S.globalAveragePool,S.parseGlobalAveragePoolAttributes],["GlobalMaxPool","","1+",S.globalMaxPool],["Greater","","7+",u.greater],["Identity","","1+",L.identity],["ImageScaler","","1+",_.imageScaler,_.parseImageScalerAttributes],["InstanceNormalization","","6+",b.instanceNormalization,b.parseInstanceNormalizationAttributes],["LeakyRelu","","6+",L.leakyRelu,L.parseLeakyReluAttributes],["Less","","7+",u.less],["Log","","6+",L.log],["MatMul","","1+",x.matMul,x.parseMatMulAttributes],["MaxPool","","1+",S.maxPool,S.parseMaxPoolAttributes],["Mul","","7+",u.mul],["Neg","","6+",L.neg],["Not","","1+",L.not],["Or","","7+",u.or],["Pad","","2-10",w.padV2,w.parsePadAttributesV2],["Pad","","11+",w.padV11,w.parsePadAttributesV11],["Pow","","7+",u.pow],["PRelu","","7+",u.pRelu],["ReduceLogSum","","1+",T.reduceLogSum,T.parseReduceAttributes],["ReduceMax","","1+",T.reduceMax,T.parseReduceAttributes],["ReduceMean","","1+",T.reduceMean,T.parseReduceAttributes],["ReduceMin","","1+",T.reduceMin,T.parseReduceAttributes],["ReduceProd","","1+",T.reduceProd,T.parseReduceAttributes],["ReduceSum","","1-12",T.reduceSum,T.parseReduceAttributes],["ReduceSumSquare","","1+",T.reduceLogSumSquare,T.parseReduceAttributes],["Relu","","6+",L.relu],["Reshape","","5+",E.reshape],["Resize","","10",M.resize,M.parseResizeAttributesV10],["Resize","","11+",M.resize,M.parseResizeAttributesV11],["Shape","","1+",P.shape],["Sigmoid","","6+",L.sigmoid],["Sin","","7+",L.sin],["Slice","","10+",A.sliceV10],["Slice","","1-9",A.slice,A.parseSliceAttributes],["Softmax","","1-12",C.softmax,C.parseSoftmaxAttributes],["Softmax","","13+",C.softmaxV13,C.parseSoftmaxAttributesV13],["Split","","2-12",D.split,D.parseSplitAttributes],["Sqrt","","6+",L.sqrt],["Squeeze","","1-12",k.squeeze,k.parseSqueezeAttributes],["Squeeze","","13+",k.squeezeV13],["Sub","","7+",u.sub],["Sum","","6+",j.sum],["Tan","","7+",L.tan],["Tanh","","6+",L.tanh],["Tile","","6+",I.tile],["Transpose","","1+",W.transpose,W.parseTransposeAttributes],["Upsample","","7-8",H.upsample,H.parseUpsampleAttributesV7],["Upsample","","9",H.upsample,H.parseUpsampleAttributesV9],["Unsqueeze","","1-12",U.unsqueeze,U.parseUnsqueezeAttributes],["Unsqueeze","","13+",U.unsqueezeV13],["Xor","","7+",u.xor]]},2898:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchNormalizationAttributes=e.batchNormalization=void 0;const n=t(246),i=t(5060),a=t(2039),l={name:"BatchNormalization",inputNames:["A","Scale","B","Mean","Variance"],inputTypes:[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]};e.batchNormalization=(f,m,s)=>(d(m),[f.run(Object.assign(Object.assign({},l),{cacheHint:s.cacheKey,get:()=>u(f,m,s)}),m)]),e.parseBatchNormalizationAttributes=f=>{const m=f.attributes.getFloat("epsilon",1e-5),s=f.attributes.getFloat("momentum",.9),o=f.attributes.getInt("spatial",1);return(0,n.createAttributeWithCacheKey)({epsilon:m,momentum:s,spatial:o})};const u=(f,m,s)=>{const o=(0,i.getGlsl)(f.session.backend.glContext.version),c=m[0].dims.length,[v,y]=f.calculateTextureWidthAndHeight(m[1].dims,a.TextureType.unpacked),_=` - float process(int[${c}] indices) { - vec2 position = offsetToCoords(indices[1], ${v}, ${y}); - float scale = getColorAsFloat(${o.texture2D}(Scale, position)); - float mean = getColorAsFloat(${o.texture2D}(Mean, position)); - float variance = getColorAsFloat(${o.texture2D}(Variance, position)); - float b = getColorAsFloat(${o.texture2D}(B, position)); - - return scale * ( (_A(indices) - mean) / sqrt(variance + float(${s.epsilon})) ) + b; - }`;return Object.assign(Object.assign({},l),{output:{dims:m[0].dims,type:m[0].type,textureType:a.TextureType.unpacked},shaderSource:_})},d=f=>{if(!f||f.length!==5)throw new Error("BatchNormalization requires 5 inputs.");const m=f[0],s=f[1],o=f[2],c=f[3],v=f[4];if(m.dims.length<3||s.dims.length!==1||o.dims.length!==1||c.dims.length!==1||v.dims.length!==1)throw new Error("invalid input shape.");if(s.dims[0]!==m.dims[1]||o.dims[0]!==m.dims[1]||c.dims[0]!==m.dims[1]||v.dims[0]!==m.dims[1])throw new Error("invalid input shape.");if(m.type!=="float32"&&m.type!=="float64"||s.type!=="float32"&&s.type!=="float64"||o.type!=="float32"&&o.type!=="float64"||c.type!=="float32"&&c.type!=="float64"||v.type!=="float32"&&v.type!=="float64")throw new Error("invalid input tensor types.")}},7839:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.xor=e.sub=e.pRelu=e.pow=e.or=e.mul=e.less=e.greater=e.equal=e.div=e.and=e.add=e.glslPRelu=e.glslPow=e.glslXor=e.glslOr=e.glslAnd=e.glslLess=e.glslGreater=e.glslEqual=e.glslSub=e.glslMul=e.glslDiv=e.glslAdd=void 0;const n=t(2517),i=t(8520),a=t(5060),l=t(2039);function u(){const T="add_";return{body:` - float ${T}(float a, float b) { - return a + b; - } - vec4 ${T}(vec4 v1, vec4 v2) { - return v1 + v2; - } - `,name:T,type:i.FunctionType.ValueBased}}function d(){const T="div_";return{body:` - float ${T}(float a, float b) { - return a / b; - } - vec4 ${T}(vec4 v1, vec4 v2) { - return v1 / v2; - } - `,name:T,type:i.FunctionType.ValueBased}}function f(){const T="mul_";return{body:` - float ${T}(float a, float b) { - return a * b; - } - vec4 ${T}(vec4 v1, vec4 v2) { - return v1 * v2; - } - `,name:T,type:i.FunctionType.ValueBased}}function m(){const T="sub_";return{body:` - float ${T}(float a, float b) { - return a - b; - } - vec4 ${T}(vec4 v1, vec4 v2) { - return v1 - v2; - } - `,name:T,type:i.FunctionType.ValueBased}}function s(){const T="equal_";return{body:` - float ${T}(float a, float b) { - return float(a == b); - } - vec4 ${T}(vec4 v1, vec4 v2) { - return vec4(equal(v1, v2)); - } - `,name:T,type:i.FunctionType.ValueBased}}function o(){const T="greater_";return{body:` - float ${T}(float a, float b) { - return float(a > b); - } - vec4 ${T}(vec4 v1, vec4 v2) { - return vec4( v1.r > v2.r , - v1.g > v2.g, - v1.b > v2.b, - v1.a > v2.a ); - } - `,name:T,type:i.FunctionType.ValueBased}}function c(){const T="less_";return{body:` - float ${T}(float a, float b) { - return float(a < b); - } - vec4 ${T}(vec4 v1, vec4 v2) { - return vec4( v1.r < v2.r , - v1.g < v2.g, - v1.b < v2.b, - v1.a < v2.a ); - } - `,name:T,type:i.FunctionType.ValueBased}}function v(){const T="and_";return{body:` - float ${T}(float a, float b) { - return float( bool(a) && bool(b) ); - } - vec4 ${T}(vec4 v1, vec4 v2) { - bvec4 b1 = bvec4(v1); - bvec4 b2 = bvec4(v2); - return vec4( b1.r && b2.r , - b1.g && b2.g, - b1.b && b2.b, - b1.a && b2.a ); - } - `,name:T,type:i.FunctionType.ValueBased}}function y(){const T="or_";return{body:` - float ${T}(float a, float b) { - return float( bool(a) || bool(b) ); - } - vec4 ${T}(vec4 v1, vec4 v2) { - bvec4 b1 = bvec4(v1); - bvec4 b2 = bvec4(v2); - return vec4( b1.r || b2.r , - b1.g || b2.g, - b1.b || b2.b, - b1.a || b2.a ); - } - `,name:T,type:i.FunctionType.ValueBased}}function _(){const T="xor_";return{body:` - float ${T}(float a, float b) { - return float( bool(a) ^^ bool(b) ); - } - vec4 ${T}(vec4 v1, vec4 v2) { - bvec4 b1 = bvec4(v1); - bvec4 b2 = bvec4(v2); - return vec4( b1.r ^^ b2.r , - b1.g ^^ b2.g, - b1.b ^^ b2.b, - b1.a ^^ b2.a ); - } - `,name:T,type:i.FunctionType.ValueBased}}function b(){return function(T){const E=`${T}_`;return{body:` - float ${E}(float a, float b) { - return ${T}(a, b); - } - vec4 ${E}(vec4 v1, vec4 v2) { - return ${T}(v1, v2); - } - `,name:E,type:i.FunctionType.ValueBased}}("pow")}function x(){const T="prelu_";return{body:` - float ${T}(float a, float b) { - return a < 0.0 ? a * b: a; - } - vec4 ${T}(vec4 v1, vec4 v2) { - return vec4( - v1.r < 0.0 ? v1.r * v2.r: v1.r, - v1.g < 0.0 ? v1.g * v2.g: v1.g, - v1.b < 0.0 ? v1.b * v2.b: v1.b, - v1.a < 0.0 ? v1.a * v2.a: v1.a - ); - } - `,name:T,type:i.FunctionType.ValueBased}}e.glslAdd=u,e.glslDiv=d,e.glslMul=f,e.glslSub=m,e.glslEqual=s,e.glslGreater=o,e.glslLess=c,e.glslAnd=v,e.glslOr=y,e.glslXor=_,e.glslPow=b,e.glslPRelu=x;const w=(T,E,M,P=E[0].type,A)=>{const C=T.session.pack?l.TextureType.packed:l.TextureType.unpacked;return{name:M.name,inputNames:["A","B"],inputTypes:[C,C],cacheHint:A,get:()=>S(T,E,M,P)}},S=(T,E,M,P=E[0].type)=>{const A=T.session.pack?l.TextureType.packed:l.TextureType.unpacked,C=!n.ShapeUtil.areEqual(E[0].dims,E[1].dims);let D=E[0].dims;const k=T.session.pack;if(C){const W=n.BroadcastUtil.calcShape(E[0].dims,E[1].dims,!1);if(!W)throw new Error("Can't perform binary op on the given tensors");D=W;const L=D.length,U=E[0].dims.length!==0?E[0].dims.length:1,H=E[1].dims.length!==0?E[1].dims.length:1,Y=E[0].dims.length!==0?"bcastIndices_A(indices, aindices);":"aindices[0] = 0;",B=E[1].dims.length!==0?"bcastIndices_B(indices, bindices);":"bindices[0] = 0;",X=(0,a.getGlsl)(T.session.backend.glContext.version),Z=k?` - ${M.body} - void main() { - vec4 a = getAAtOutCoords(); - vec4 b = getBAtOutCoords(); - vec4 result = ${M.name}(a, b); - ${X.output} = result; - }`:` - ${M.body} - float process(int indices[${L}]) { - int aindices[${U}]; - int bindices[${H}]; - ${Y} - ${B} - return ${M.name}(_A(aindices), _B(bindices)); - }`;return{name:M.name,inputNames:["A","B"],inputTypes:[A,A],output:{dims:D,type:P,textureType:A},shaderSource:Z,hasMain:k}}const j=(0,a.getGlsl)(T.session.backend.glContext.version),I=` - ${M.body} - void main() { - vec4 v1 = ${j.texture2D}(A, TexCoords); - vec4 v2 = ${j.texture2D}(B, TexCoords); - vec4 result = ${M.name}(v1, v2); - ${j.output} = result; - } - `;return{name:M.name,inputNames:["A","B"],inputTypes:[A,A],output:{dims:E[0].dims,type:P,textureType:A},shaderSource:I,hasMain:!0}};e.add=(T,E)=>[T.run(w(T,E,u()),E)],e.and=(T,E)=>[T.run(w(T,E,v(),"bool"),E)],e.div=(T,E)=>[T.run(w(T,E,d()),E)],e.equal=(T,E)=>[T.run(w(T,E,s(),"bool"),E)],e.greater=(T,E)=>[T.run(w(T,E,o(),"bool"),E)],e.less=(T,E)=>[T.run(w(T,E,c(),"bool"),E)],e.mul=(T,E)=>[T.run(w(T,E,f()),E)],e.or=(T,E)=>[T.run(w(T,E,y(),"bool"),E)],e.pow=(T,E)=>[T.run(w(T,E,b()),E)],e.pRelu=(T,E)=>[T.run(w(T,E,x()),E)],e.sub=(T,E)=>[T.run(w(T,E,m()),E)],e.xor=(T,E)=>[T.run(w(T,E,_(),"bool"),E)]},4196:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseCastAttributes=e.cast=void 0;const n=t(2517);e.cast=(a,l,u)=>(i(l),[a.cast(l[0],u)]),e.parseCastAttributes=a=>n.ProtoUtil.tensorDataTypeFromProto(a.attributes.getInt("to"));const i=a=>{if(!a||a.length!==1)throw new Error("Cast requires 1 input.");if(a[0].type==="string")throw new Error("Invalid input type.")}},1163:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedConcatProgramInfoLoader=void 0;const n=t(5060),i=t(2039),a=t(9390),l=t(2827);e.createPackedConcatProgramInfoLoader=(d,f,m)=>{const s=(o=f.length,c=m.cacheKey,{name:"Concat (packed)",inputNames:Array.from({length:o},(v,y)=>`X${y}`),inputTypes:Array(o).fill(i.TextureType.packed),cacheHint:c});var o,c;return Object.assign(Object.assign({},s),{get:()=>((v,y,_,b)=>{const x=_[0].dims.slice();if(b>=x.length||b<-1*x.length)throw new Error("axis specified for concat doesn't match input dimensionality");b<0&&(b=x.length+b);const w=x.slice(0);for(let Y=1;Y<_.length;Y++){const B=_[Y].dims.slice();for(let X=0;XY.dims),A=(0,a.getGlChannels)(S),C=new Array(P.length-1);C[0]=P[0][b];for(let Y=1;Y= ${C[Y-1]}) { - return getChannel( - getX${Y}(${u(A,D,B)}), - vec2(${u(k,D,B)})); - }`}const W=C.length,L=C[C.length-1];I+=` - return getChannel( - getX${W}(${u(A,D,L)}), - vec2(${u(k,D,L)}));`;const U=(0,n.getGlsl)(v.session.backend.glContext.version),H=` - ${M} - float getValue(${A.map(Y=>"int "+Y)}) { - ${I} - } - - void main() { - ${E} coords = getOutputCoords(); - int lastDim = coords.${A[S-1]}; - coords.${A[S-1]} = coords.${A[S-2]}; - coords.${A[S-2]} = lastDim; - - vec4 result = vec4(getValue(${T}), 0., 0., 0.); - - ${T[S-1]} = ${T[S-1]} + 1; - if (${T[S-1]} < ${w[S-1]}) { - result.g = getValue(${T}); - } - - ${T[S-2]} = ${T[S-2]} + 1; - if (${T[S-2]} < ${w[S-2]}) { - result.a = getValue(${T}); - } - - ${T[S-1]} = ${T[S-1]} - 1; - if (${T[S-2]} < ${w[S-2]} && - ${T[S-1]} < ${w[S-1]}) { - result.b = getValue(${T}); - } - ${U.output} = result; - } - `;return Object.assign(Object.assign({},y),{output:{dims:w,type:_[0].type,textureType:i.TextureType.packed},shaderSource:H,hasMain:!0})})(d,s,f,m.axis)})};const u=(d,f,m)=>{const s=d.indexOf(f);return d.map((o,c)=>c===s?`${o} - ${m}`:o).join()}},2069:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseConcatAttributes=e.concat=void 0;const n=t(246),i=t(2039),a=t(1163);e.concat=(o,c,v)=>(s(c),o.session.pack&&c[0].dims.length>1?[o.run((0,a.createPackedConcatProgramInfoLoader)(o,c,v),c)]:[o.run(l(o,c,v),c)]);const l=(o,c,v)=>{const y=(_=c.length,b=v.cacheKey,{name:"Concat",inputNames:Array.from({length:_},(x,w)=>`X${w}`),inputTypes:Array(_).fill(i.TextureType.unpacked),cacheHint:b});var _,b;return Object.assign(Object.assign({},y),{get:()=>((x,w,S,T)=>{const E=S[0].dims.slice();if(T>=E.length||T<-1*E.length)throw new Error("axis specified for concat doesn't match input dimensionality");T<0&&(T=E.length+T);const M=E.slice(0);for(let j=1;j`int getTextureWhereDataResides(int index) { - ${o.map((c,v)=>`if(index<${c}) {return ${v};} -`).join("")} - }`,d=o=>u(o),f=(o,c)=>{const v=[`float fetchDataFromCorrectTexture(int textureIndex, int indices[${c}]) {`];for(let y=0;y{const c=["int getSizeInConcatAxisValueFromIndex(int index) {"];for(let v=0;v(0,n.createAttributeWithCacheKey)({axis:o.attributes.getInt("axis")});const s=o=>{if(!o||o.length<1)throw new Error("too few inputs");const c=o[0].type,v=o[0].dims.length;if(c==="string")throw new Error("string tensor is not supported yet");for(const y of o){if(y.type!==c)throw new Error("input tensors should be one type");if(y.dims.length!==v)throw new Error("input tensors should have the same shape")}}},4770:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackedGroupedConvProgramInfoLoader=void 0;const n=t(6231),i=t(5060),a=t(2039),l=t(8138),u=t(2823);e.createUnpackedGroupedConvProgramInfoLoader=(d,f,m)=>{const s=(o=f.length>2,c=m.cacheKey,{name:"GroupedConv",inputNames:o?["X","W","Bias"]:["X","W"],inputTypes:o?[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]:[a.TextureType.unpacked,a.TextureType.unpacked],cacheHint:c});var o,c;return Object.assign(Object.assign({},s),{get:()=>((v,y,_,b)=>{const x=y.length>2?"value += getBias(output_channel);":"",w=y[0].dims.slice(),S=y[1].dims.slice(),T=S[0]/b.group;n.Logger.verbose("GroupedConv",`autpPad:${b.autoPad}, dilations:${b.dilations}, group:${b.group}, kernelShape:${b.kernelShape}, pads:${b.pads}, strides:${b.strides}`);const E=(0,l.calculateOutputShape)(w,S,b.dilations,b.pads,b.strides),M=(0,i.getGlsl)(v.session.backend.glContext.version),{activationFunction:P,applyActivation:A}=(0,u.getActivationSnippet)(b),C=` - const ivec2 strides = ivec2(${b.strides[0]}, ${b.strides[1]}); - const ivec2 pads = ivec2(${b.pads[0]}, ${b.pads[1]}); - ${P} - void main() { - ivec4 coords = getOutputCoords(); - int batch = coords.x; - int output_channel = coords.y; - ivec2 xRCCorner = coords.zw * strides - pads; - int group_id = output_channel / ${T}; - - float value = 0.0; - for (int wInChannel = 0; wInChannel < ${S[1]}; wInChannel++) { - int input_channel = group_id * ${S[1]} + wInChannel; - for (int wHeight = 0; wHeight < ${S[2]}; wHeight++) { - int xHeight = xRCCorner.x + wHeight * ${b.dilations[0]}; - - if (xHeight < 0 || xHeight >= ${w[2]}) { - continue; - } - - for (int wWidth = 0; wWidth < ${S[3]}; wWidth++) { - int xWidth = xRCCorner.y + wWidth * ${b.dilations[1]}; - if (xWidth < 0 || xWidth >= ${w[3]}) { - continue; - } - - float xVal = getX(batch, input_channel, xWidth, xHeight); - float wVal = getW(output_channel, wInChannel, wWidth, wHeight); - value += xVal*wVal; - } - } - } - ${x} - ${A} - ${M.output} = vec4(value, .0, .0, .0); - } -`;return Object.assign(Object.assign({},_),{output:{dims:E,type:y[0].type,textureType:a.TextureType.unpacked},shaderSource:C,hasMain:!0})})(d,f,s,m)})}},1386:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.conv2DPacked=e.conv2DPackedPointwise=void 0;const n=t(8138),i=t(8555),a=t(708);e.conv2DPackedPointwise=(l,u,d)=>{const f=u[0].dims,m=u[1].dims,s=(0,n.calculateOutputShape)(f,m,d.dilations,d.pads,d.strides),o=l.reshapePacked(u[0],[f[1],f[2]*f[3]]),c=l.reshapePacked(u[1],[m[0],m[1]]),v=u.length>2?[c,o,u[2]]:[c,o],y=l.run((0,a.createPackedMatmulProgramInfoLoader)(l,v,d),v);return l.reshapePacked(y,s)},e.conv2DPacked=(l,u,d)=>{const f=u[0].dims,m=u[1].dims,s=(0,n.calculateOutputShape)(f,m,d.dilations,d.pads,d.strides),o=l.run((0,i.createPackedIm2ColProgramInfoLoader)(l,u[0],u[1],s,d),[u[0]]),c=l.reshapePacked(u[1],[m[0],m[1]*m[2]*m[3]]),v=u.length===3?[c,o,u[2]]:[c,o],y=l.run((0,a.createPackedMatmulProgramInfoLoader)(l,v,d),v);return l.reshapePacked(y,s)}},9663:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvTransposeAttributes=e.convTranspose=void 0;const n=t(246),i=t(5060),a=t(2039),l=t(2823),u=(c,v,y,_,b,x)=>(c-1)*v+y+(_-1)*b+1-x,d=(c,v,y,_,b)=>{const x=Math.floor(c/2);v==="SAME_UPPER"?(y[_]=x,y[b]=c-x):v==="SAME_LOWER"&&(y[_]=c-x,y[b]=x)};e.convTranspose=(c,v,y)=>(o(v,y),f(c,v,y));const f=(c,v,y)=>{const _=s(y,v);return[m(c,v,_)]},m=(c,v,y)=>c.run(((_,b,x)=>{const w=(S=b.length>2,T=x.cacheKey,{name:"ConvTranspose",inputNames:S?["X","W","B"]:["X","W"],inputTypes:S?[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]:[a.TextureType.unpacked,a.TextureType.unpacked],cacheHint:T});var S,T;return Object.assign(Object.assign({},w),{get:()=>((E,M,P,A)=>{const C=M.length>2?"getB(output_channel)":"0.0",D=M[0].dims,k=M[1].dims,j=k[1],I=k[0]/A.group,W=[M[0].dims[0],M[1].dims[1]*A.group,...A.outputShape],L=(0,i.getGlsl)(E.session.backend.glContext.version),{activationFunction:U,applyActivation:H}=(0,l.getActivationSnippet)(A),Y=` - const ivec2 strides = ivec2(${A.strides[0]}, ${A.strides[1]}); - const ivec2 pads = ivec2(${A.pads[0]}, ${A.pads[1]}); - ${U} - void main() { - ivec4 coords = getOutputCoords(); - int batch = coords.x; - int output_channel = coords.y; - - ivec2 loc = coords.zw + pads; - - int group_id = output_channel / ${j}; - int wOutChannel = output_channel - group_id * ${j}; - - float value = ${C}; - for (int inChannelOffset = 0; inChannelOffset < ${I}; inChannelOffset++) { - int input_channel = group_id * ${I} + inChannelOffset; - for (int wWOff = 0; wWOff < ${k[2]}; wWOff++) { - for (int wHOff = 0; wHOff < ${k[3]}; wHOff++) { - ivec2 wOff = ivec2(wWOff * ${A.dilations[0]}, wHOff * ${A.dilations[1]}); - ivec2 wLoc = loc - wOff; - ivec2 wLocIn = wLoc / strides; - if ( - wLocIn * strides == wLoc && - wLocIn.x >= 0 && wLocIn.x < ${D[2]} && - wLocIn.y >= 0 && wLocIn.y < ${D[3]} - ) { - float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x); - float wVal = getW(input_channel, wOutChannel, wHOff, wWOff); - value += xVal * wVal; - } - } - } - } - ${H} - ${L.output} = vec4(value, .0, .0, .0); - } -`;return Object.assign(Object.assign({},P),{output:{dims:W,type:M[0].type,textureType:a.TextureType.unpacked},shaderSource:Y,hasMain:!0})})(_,b,w,x)})})(c,v,y),v),s=(c,v)=>{const y=c.kernelShape.slice();if(c.kernelShape.length===0)for(let w=2;w{const D=w.length-2,k=C.length===0;for(let j=0;j{const v=c.attributes,y=(0,l.parseInternalActivationAttributes)(v),_=v.getString("auto_pad","NOTSET"),b=v.getInts("dilations",[1,1]),x=v.getInt("group",1),w=v.getInts("kernel_shape",[]),S=v.getInts("output_padding",[0,0]),T=v.getInts("output_shape",[]),E=v.getInts("pads",[0,0,0,0]),M=v.getInts("strides",[1,1]);return(0,n.createAttributeWithCacheKey)(Object.assign({autoPad:_,dilations:b,group:x,kernelShape:w,outputPadding:S,outputShape:T,pads:E,strides:M},y))};const o=(c,v)=>{if(!c||c.length!==2&&c.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(c[0].dims.length!==4||c[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(c[0].dims[1]!==c[1].dims[0])throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");const y=c[1].dims[1]*v.group;if(c.length===3&&(c[2].dims.length!==1||c[2].dims[0]!==y))throw new Error("invalid bias");const _=c[0].dims.length-2;if(v.dilations.length!==_)throw new Error(`dilations should be ${_}D`);if(v.strides.length!==_)throw new Error(`strides should be ${_}D`);if(v.pads.length!==2*_)throw new Error(`pads should be ${2*_}D`);if(v.outputPadding.length!==_)throw new Error(`output_padding should be ${_}D`);if(v.kernelShape.length!==0&&v.kernelShape.length!==c[1].dims.length-2)throw new Error("invalid kernel shape");if(v.outputShape.length!==0&&v.outputShape.length!==c[0].dims.length-2)throw new Error("invalid output shape");if(c[0].type!=="float32"||c[1].type!=="float32")throw new Error("ConvTranspose input(X,W) should be float tensor");if(c.length===3&&c[2].type!=="float32")throw new Error("ConvTranspose input(bias) should be float tensor")}},8138:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseConvAttributes=e.conv=e.calculateOutputShape=void 0;const n=t(246),i=t(2517),a=t(4770),l=t(1386),u=t(9828),d=t(2823),f=t(3248),m=t(5623);e.calculateOutputShape=(_,b,x,w,S)=>{const T=_[0],E=_.slice(2),M=E.length,P=b[0],A=b.slice(2).map((D,k)=>D+(D-1)*(x[k]-1)),C=E.map((D,k)=>D+w[k]+w[k+M]).map((D,k)=>Math.floor((D-A[k]+S[k])/S[k]));return[T,P].concat(...C)},e.conv=(_,b,x)=>(y(b,x),s(_,b,x));const s=(_,b,x)=>{const w=v(x,b),S=_.session.pack,T=w.kernelShape[0]===1&&w.kernelShape[1]===1;return w.group>1?[_.run((0,a.createUnpackedGroupedConvProgramInfoLoader)(_,b,w),b)]:T&&S?[o(_,b,w)]:S&&b[0].dims.length===4&&b[0].dims[0]===1&&!T?[(0,l.conv2DPacked)(_,b,w)]:[c(_,b,w)]},o=(_,b,x)=>{const w=b[0].dims,S=b[1].dims,T=(0,e.calculateOutputShape)(w,S,x.dilations,x.pads,x.strides),E=_.reshapeUnpacked(b[0],[w[1],w[2]*w[3]]),M=_.reshapeUnpacked(b[1],[S[0],S[1]]),P=b.length>2?[M,E,b[2]]:[M,E],A=_.run((0,m.createMatmulProgramInfoLoader)(P,x),P);return _.reshapeUnpacked(A,T)},c=(_,b,x)=>{const w=b[0].dims,S=b[1].dims,T=(0,e.calculateOutputShape)(w,S,x.dilations,x.pads,x.strides),E=_.run((0,f.createIm2ColProgramInfoLoader)(_,b[0],b[1],T,x),[b[0]]),M=b.length===3?[E,b[1],b[2]]:[E,b[1]];return _.run((0,u.createDotProductProgramInfoLoader)(_,b,T,x),M)},v=(_,b)=>{const x=_.kernelShape.slice();if(_.kernelShape.length===0)for(let T=2;T{const b=_.attributes,x=(0,d.parseInternalActivationAttributes)(b),w=b.getString("auto_pad","NOTSET"),S=b.getInts("dilations",[1,1]),T=b.getInt("group",1),E=b.getInts("kernel_shape",[]),M=b.getInts("pads",[0,0,0,0]),P=b.getInts("strides",[1,1]);return(0,n.createAttributeWithCacheKey)(Object.assign({autoPad:w,dilations:S,group:T,kernelShape:E,pads:M,strides:P},x))};const y=(_,b)=>{if(!_||_.length!==2&&_.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(_[0].dims.length!==4||_[1].dims.length!==4)throw new Error("currently only support 2-dimensional conv");if(_[0].dims[1]!==_[1].dims[1]*b.group)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(_.length===3&&(_[2].dims.length!==1||_[1].dims[0]!==_[2].dims[0]))throw new Error("invalid bias");const x=_[0].dims.length-2;if(b.dilations.length!==x)throw new Error(`dilations should be ${x}D`);if(b.strides.length!==x)throw new Error(`strides should be ${x}D`);if(b.pads.length!==2*x)throw new Error(`pads should be ${2*x}D`);if(b.kernelShape.length!==0&&b.kernelShape.length!==_[1].dims.length-2)throw new Error("invalid kernel shape");if(_[0].type!=="float32"||_[1].type!=="float32")throw new Error("Conv input(X,W) should be float tensor");if(_.length===3&&_[2].type!=="float32")throw new Error("Conv input(bias) should be float tensor")}},5193:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseDepthToSpaceAttributes=e.depthToSpace=void 0;const n=t(3738);e.depthToSpace=(a,l,u)=>{i(l);const d=u.blocksize,f=d*d,m=u.mode==="DCR"?[0,3,4,1,5,2]:[0,1,4,2,5,3],s=u.mode==="DCR"?[l[0].dims[0],d,d,l[0].dims[1]/f,l[0].dims[2],l[0].dims[3]]:[l[0].dims[0],l[0].dims[1]/f,d,d,l[0].dims[2],l[0].dims[3]],o=a.reshapeUnpacked(l[0],s),c={perm:m,cacheKey:`${m}`},[v]=(0,n.transpose)(a,[o],c),y=[l[0].dims[0],l[0].dims[1]/f,l[0].dims[2]*d,l[0].dims[3]*d];return[a.reshapeUnpacked(v,y)]},e.parseDepthToSpaceAttributes=a=>{const l=a.attributes.getInt("blocksize");if(l<1)throw new Error(`blocksize must be >= 1, but got : ${l} for DepthToSpace`);const u=a.attributes.getString("mode","DCR");if(u!=="DCR"&&u!=="CRD")throw new Error(`unrecognized mode: ${u} for DepthToSpace`);return{mode:u,blocksize:l}};const i=a=>{if(a.length!==1)throw new Error(`DepthToSpace expect 1 inputs, but got ${a.length}`);if(a[0].type==="string"||a[0].dims.length!==4)throw new TypeError("DepthToSpace input should be a 4-D numeric tensor")}},9828:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createDotProductProgramInfoLoader=void 0;const n=t(2517),i=t(5060),a=t(2039),l=t(2823),u=t(3248);e.createDotProductProgramInfoLoader=(d,f,m,s)=>{const o=((c,v)=>({name:"ConvDotProduct",inputNames:c?["Im2Col","K","B"]:["Im2Col","K"],inputTypes:c?[a.TextureType.unpacked,a.TextureType.packedLastDimension,a.TextureType.unpacked]:[a.TextureType.unpacked,a.TextureType.packedLastDimension],cacheKey:v.activationCacheKey}))(f.length>2,s);return Object.assign(Object.assign({},o),{get:()=>((c,v,y,_,b)=>{const x=y[0].dims,w=y[1].dims,S=[w[0],Math.ceil(x[1]*w[2]*w[3]/4)],T=(0,u.calculateIm2ColDims)(x,w,_),[E,M]=c.calculateTextureWidthAndHeight(S,a.TextureType.packedLastDimension),P=n.ShapeUtil.computeStrides(T),[A,C]=c.calculateTextureWidthAndHeight(T,a.TextureType.packedLastDimension),D=_.length,k=y.length<3?"0.0":"_B(b)",j=Math.ceil(x[1]*w[2]*w[3]/4),{activationFunction:I,applyActivation:W}=(0,l.getActivationSnippet)(b),L=(0,i.getGlsl)(c.session.backend.glContext.version),U=` -${I} -float process(int indices[${D}]) { - int b[1]; - b[0] = indices[1]; - int im2col[4]; - im2col[0] = indices[0]; - im2col[1] = indices[2]; - im2col[2] = indices[3]; - int im2colOffset = im2col[0] * ${P[0]} + im2col[1] * ${P[1]} + im2col[2] * ${P[2]}; - int kernelOffset = indices[1] * ${S[1]}; - float value = ${k}; - for (int i = 0; i < ${j}; ++i) { - vec2 im2colCoords = offsetToCoords(im2colOffset, ${A}, ${C}); - vec2 kernelCoords = offsetToCoords(kernelOffset, ${E}, ${M}); - value += dot(${L.texture2D}(Im2Col, im2colCoords), ${L.texture2D}(K, kernelCoords)); - ++im2colOffset; - ++kernelOffset; - } - ${W} - return value; -}`;return Object.assign(Object.assign({},v),{output:{dims:_,type:y[0].type,textureType:a.TextureType.unpacked},shaderSource:U})})(d,o,f,m,s)})}},7992:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseFlattenAttributes=e.flatten=void 0;const n=t(2517);e.flatten=(a,l,u)=>{i(l,u);const d=n.ShapeUtil.flattenShape(l[0].dims,u);return[a.reshapeUnpacked(l[0],d)]},e.parseFlattenAttributes=a=>a.attributes.getInt("axis",1);const i=(a,l)=>{if(!a||a.length!==1)throw new Error("Flatten requires 1 input.");const u=a[0].dims.length;if(u===0)throw new Error("scalar tensor is not supported.");if(l<-u||l>u)throw new Error("Invalid axis");if(a[0].type==="string")throw new Error("string tensor is not supported.")}},2823:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseInternalActivationAttributes=e.getActivationSnippet=void 0;const n=t(2517),i=t(4909);e.getActivationSnippet=function(a){let l;switch(a.activation){case"Relu":l=(0,i.glslRelu)();break;case"Sigmoid":l=(0,i.glslSigmoid)();break;case"Clip":l=(0,i.glslClip)(a.clipMin,a.clipMax);break;default:return{activationFunction:"",applyActivation:""}}const u=l.name;return{activationFunction:l.body,applyActivation:`value = ${u}_(value);`}},e.parseInternalActivationAttributes=a=>{const l=a.getString("activation","");if(l==="Clip"){const[u,d]=a.getFloats("activation_params",[n.MIN_CLIP,n.MAX_CLIP]);return{activation:l,clipMax:d,clipMin:u,activationCacheKey:`${l}:${u},${d}`}}return{activation:l,activationCacheKey:l}}},1253:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseGatherAttributes=e.gather=void 0;const n=t(246),i=t(782),a=t(2517),l=t(2039);e.gather=(m,s,o)=>(f(s,o.axis),[m.run(d(m,s,o),s)]),e.parseGatherAttributes=m=>(0,n.createAttributeWithCacheKey)({axis:m.attributes.getInt("axis",0)});const u={name:"Gather",inputNames:["A","B"],inputTypes:[l.TextureType.unpacked,l.TextureType.unpacked]},d=(m,s,o)=>{const c=Object.assign(Object.assign({},u),{cacheHint:o.cacheKey});return Object.assign(Object.assign({},c),{get:()=>((v,y,_,b)=>{const x=_[0].dims.slice(),w=_[1].dims.slice(),S=new Array(x.length+w.length-1);b=a.ShapeUtil.normalizeAxis(b,x.length);const T=[];for(let M=0;M{if(!m||m.length!==2)throw new Error("Gather requires 2 inputs.");const o=m[0].dims.length;if(o<1)throw new Error("Invalid input shape.");if(s<-o||s>o-1)throw new Error("Invalid axis.");if(i.NUMBER_TYPES.indexOf(m[0].type)===-1)throw new Error("Invaid input type.");if(m[1].type!=="int32"&&m[1].type!=="int16")throw new Error("Invaid input type.")}},4776:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseGemmAttributesV11=e.parseGemmAttributesV7=e.gemm=void 0;const n=t(246),i=t(2517),a=t(2039);e.gemm=(m,s,o)=>(f(s,o),[m.run(u(s,o),s)]);const l=(m,s)=>{const o=m.attributes.getInt("transA",0)!==0,c=m.attributes.getInt("transB",0)!==0,v=m.attributes.getFloat("alpha",1),y=m.attributes.getFloat("beta",1);return(0,n.createAttributeWithCacheKey)({transA:o,transB:c,alpha:v,beta:y,isOptionalC:s})};e.parseGemmAttributesV7=m=>l(m,!1),e.parseGemmAttributesV11=m=>l(m,!0);const u=(m,s)=>{const o={name:"Gemm",inputNames:m.length===3?["A","B","C"]:["A","B"],inputTypes:m.length===3?[a.TextureType.unpacked,a.TextureType.unpacked,a.TextureType.unpacked]:[a.TextureType.unpacked,a.TextureType.unpacked],key:s.cacheKey};return Object.assign(Object.assign({},o),{get:()=>d(o,m,s)})},d=(m,s,o)=>{const c=s[0].dims.slice(),v=s[1].dims.slice(),[y,_]=i.GemmUtil.getShapeOfGemmResult(c,o.transA,v,o.transB,s.length===3?s[2].dims:void 0),b=[y,_];if(!b)throw new Error("Can't use gemm on the given tensors");let x=c[c.length-1],w="";o.transA&&(x=c[0]),o.transA&&o.transB?w="value += _A_T(a) * _B_T(b);":o.transA&&!o.transB?w="value += _A_T(a) * _B(b);":!o.transA&&o.transB?w="value += _A(a) * _B_T(b);":o.transA||o.transB||(w="value += _A(a) * _B(b);");const S=b.length,T=` - float process(int indices[${S}]) { - int a[${S}]; - int b[${S}]; - ${s.length===3?`int c[${s[2].dims.length}];`:""} - - copyVec(indices, a); - copyVec(indices, b); - ${s.length===3?"bcastIndices_C(indices, c);":""} - - float value = 0.0; - for (int k=0; k<${x}; ++k) { - a[${S-1}] = k; - b[${S-2}] = k; - ${w} - } - - value = value * alpha; - ${s.length===3?"value += beta * _C(c);":""} - return value; - }`;return Object.assign(Object.assign({},m),{output:{dims:b,type:s[0].type,textureType:a.TextureType.unpacked},variables:[{name:"alpha",type:"float",data:o.alpha},{name:"beta",type:"float",data:o.beta}],shaderSource:T})},f=(m,s)=>{if(!m)throw new Error("Input is missing");if(s.isOptionalC&&(m.length<2||m.length>3))throw new Error("Invaid input shape.");if(!s.isOptionalC&&m.length!==3)throw new Error("Gemm requires 3 inputs");if(m.length===3&&m[2].dims.length!==1&&m[2].dims.length!==2)throw new Error("Invalid input shape of C");if(m[0].type!=="float32"&&m[0].type!=="float64"||m[1].type!=="float32"&&m[1].type!=="float64"||m.length===3&&m[2].type!=="float32"&&m[2].type!=="float64")throw new Error("Invalid input type.");if(m[0].type!==m[1].type||m.length===3&&m[0].type!==m[2].type)throw new Error("Input types are mismatched")}},8555:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedIm2ColProgramInfoLoader=void 0;const n=t(5060),i=t(2039),a=t(2827);e.createPackedIm2ColProgramInfoLoader=(l,u,d,f,m)=>{const s=(o=m.cacheKey,{name:"Im2Col (packed)",inputNames:["A"],inputTypes:[i.TextureType.packed],cacheHint:o});var o;return Object.assign(Object.assign({},s),{get:()=>((c,v,y,_,b,x)=>{const w=y.dims,S=_.dims,T=b.length,E=[S[1]*S[2]*S[3],b[2]*b[3]],M=S[2]*S[3],P=(0,a.unpackFromChannel)(),A=(0,n.getGlsl)(c.session.backend.glContext.version);let C="";for(let k=0;k<=1;k++)for(let j=0;j<=1;j++)C+=` - blockIndex = rc.x + ${j}; - pos = rc.y + ${k}; - - if(blockIndex < ${E[1]} && pos < ${E[0]}) { - offsetY = int(blockIndex / (${b[T-1]})) * ${x.strides[0]} - - ${x.pads[0]}; - d0 = offsetY + ${x.dilations[0]} * (imod(pos, ${M}) / ${S[2]}); - - if(d0 < ${w[2]} && d0 >= 0) { - offsetX = imod(blockIndex, ${b[T-1]}) * ${x.strides[1]} - - ${x.pads[1]}; - d1 = offsetX + ${x.dilations[1]} * imod(imod(pos, ${M}), ${S[2]}); - - if(d1 < ${w[3]} && d1 >= 0) { - - ch = int(float(pos)/ ${M}.); - innerDims = vec2(d0, d1); - result[${2*k+j}] = getChannel( - getA(0, ch, int(innerDims.x), - int(innerDims.y)), innerDims); - } - } - } - - `;const D=` - ${P} - - void main() { - ivec2 rc = getOutputCoords(); - vec4 result = vec4(0.0); - int blockIndex, pos, offsetY, d0, offsetX, d1, ch; - vec2 innerDims; - ${C} - ${A.output} = result; - } - `;return Object.assign(Object.assign({},v),{output:{dims:E,type:y.type,textureType:i.TextureType.packed},shaderSource:D,hasMain:!0})})(l,s,u,d,f,m)})}},3248:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.calculateIm2ColDims=e.createIm2ColProgramInfoLoader=void 0;const n=t(2039);e.createIm2ColProgramInfoLoader=(i,a,l,u,d)=>{const f=(m=d.cacheKey,{name:"Im2Col",inputNames:["X"],inputTypes:[n.TextureType.unpacked],cacheHint:m});var m;return Object.assign(Object.assign({},f),{get:()=>((s,o,c,v,y,_)=>{const b=c.dims,x=v.dims,w=y.length,S=(0,e.calculateIm2ColDims)(b,x,y,4),T=` - const int XC = ${b[1]}; - const int XH = ${b[2]}; - const int XW = ${b[3]}; - const int KH = ${_.kernelShape[0]}; - const int KW = ${_.kernelShape[1]}; - const int dilationH = ${_.dilations[0]}; - const int dilationW = ${_.dilations[1]}; - const int strideH = ${_.strides[0]}; - const int strideW = ${_.strides[1]}; - const int padH = ${_.pads[0]}; - const int padW = ${_.pads[1]}; - const int KHKW = KH*KW; - const int XCKHKW = XC * KHKW; - const int outputChannels = 4; - vec4 process(int indices[${w}]) { - int b = indices[0]; // batch size - int oh = indices[1] * strideH - padH; //output height - int ow = indices[2] * strideW - padW; //output width - int p = indices[3] * outputChannels; //patch - vec4 value = vec4(0.0); - for(int i=0; i < outputChannels; ++i) { - if(p < XCKHKW) { - int patchC = p / KHKW; - int patchH = (p - patchC*KHKW) / KW; - int patchW = (p - patchC*KHKW) - patchH * KW; - int xh2 = oh + patchH * dilationH; - int xw2 = ow + patchW * dilationW; - int x[${b.length}]; - x[0] = b; - x[1] = patchC; - x[2] = xh2; - x[3] = xw2; - if(xh2 >= 0 && - xh2 < XH && - xw2 >= 0 && - xw2 < XW) { - value[i] = _X(x); - } - } - ++p; - } - return value; - } - `;return Object.assign(Object.assign({},o),{output:{dims:S,type:c.type,textureType:n.TextureType.packedLastDimension},shaderSource:T})})(0,f,a,l,u,d)})},e.calculateIm2ColDims=(i,a,l,u=4)=>[l[0],l[2],l[3],Math.ceil(i[1]*a[2]*a[3]/u)]},6572:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseImageScalerAttributes=e.imageScaler=void 0;const n=t(246),i=t(2039);e.imageScaler=(f,m,s)=>(d(m),[f.run(l(f,m,s),m)]),e.parseImageScalerAttributes=f=>{const m=f.attributes.getFloat("scale"),s=f.attributes.getFloats("bias");return(0,n.createAttributeWithCacheKey)({scale:m,bias:s})};const a={name:"ImageScaler",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},l=(f,m,s)=>{const o=Object.assign(Object.assign({},a),{cacheHint:s.cacheKey});return Object.assign(Object.assign({},o),{get:()=>((c,v,y,_)=>{const b=y[0].dims.slice(),x=b.length,w=` - ${u(_.bias.length)} - float process(int indices[${x}]) { - return _X(indices) * scale + getBias(bias, indices[1]); - }`;return Object.assign(Object.assign({},v),{output:{dims:b,type:y[0].type,textureType:i.TextureType.unpacked},variables:[{name:"bias",type:"float",arrayLength:_.bias.length,data:_.bias},{name:"scale",type:"float",data:_.scale}],shaderSource:w})})(0,o,m,s)})},u=f=>{const m=[`float getBias(float bias[${f}], int channel) {`];for(let s=0;s{if(!f||f.length!==1)throw new Error("ImageScaler requires 1 input.");if(f[0].dims.length!==4)throw new Error("Invalid input shape.");if(f[0].type!=="float32"&&f[0].type!=="float64")throw new Error("Invalid input type.")}},3346:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseInstanceNormalizationAttributes=e.instanceNormalization=void 0;const n=t(5060),i=t(2039);e.instanceNormalization=(m,s,o)=>{f(s);const c=m.run(l(s[0]),s);return[m.run(d(m,s[0],o,c.dims),[s[0],c,s[1],s[2]])]},e.parseInstanceNormalizationAttributes=m=>m.attributes.getFloat("epsilon",1e-5);const a={name:"InstanceNormalization_MeanAndVariance",inputNames:["X"],inputTypes:[i.TextureType.unpacked]},l=m=>Object.assign(Object.assign({},a),{get:()=>((s,o)=>{const c=o.dims.slice(),v=c[1],y=c[2]*c[3],_=[c[0],v],b=` - vec4 process(int[2] indices) { - vec4 v = vec4(0.0); - int a[4]; - a[0] = indices[0]; - a[1] = indices[1]; - float temp = 0.0; - for(int a2=0; a2<${c[2]}; a2++) { - a[2] = a2; - for(int a3=0; a3<${c[3]}; a3++) { - a[3] = a3; - float x = _X(a); - temp += x; - } - } - float mean = temp / float(${y}); - temp = 0.0; - for(int a2=0; a2<${c[2]}; a2++) { - a[2] = a2; - for(int a3=0; a3<${c[3]}; a3++) { - a[3] = a3; - float x = _X(a); - temp += (x - mean) * (x - mean); - } - } - v.r = mean; - v.g = temp / float(${y}); - - return v; - }`;return Object.assign(Object.assign({},s),{output:{dims:_,type:o.type,textureType:i.TextureType.packedLastDimension},shaderSource:b})})(a,m)}),u={name:"InstanceNormalization_ComputeOutput",inputNames:["X","MeanAndVariance","Scale","B"],inputTypes:[i.TextureType.unpacked,i.TextureType.packedLastDimension,i.TextureType.unpacked,i.TextureType.unpacked]},d=(m,s,o,c)=>{const v=Object.assign(Object.assign({},u),{cacheHint:`${o}`});return Object.assign(Object.assign({},v),{get:()=>((y,_,b,x,w)=>{const S=(0,n.getGlsl)(y.session.backend.glContext.version),[T,E]=y.calculateTextureWidthAndHeight(w,i.TextureType.packedLastDimension),[M,P]=[T/4,E],A=` - vec4 get_MeanAndVariance(int[2] mv) { - int offset = indicesToOffset_MeanAndVariance(mv); - vec2 coords = offsetToCoords(offset, ${M}, ${P}); - return ${S.texture2D}(MeanAndVariance, coords); - } - - float process(int[4] indices) { - int mv[2]; - mv[0] = indices[0]; - mv[1] = indices[1]; - vec4 mean_and_variance = get_MeanAndVariance(mv); - float mean = mean_and_variance.r; - float variance = mean_and_variance.g; - - int sb[1]; - sb[0] = indices[1]; - float scale = _Scale(sb); - float b = _B(sb); - - return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b; - }`;return Object.assign(Object.assign({},_),{output:{dims:b.dims,type:b.type,textureType:i.TextureType.unpacked},variables:[{name:"epsilon",type:"float",data:x}],shaderSource:A})})(m,v,s,o,c)})},f=m=>{if(!m||m.length!==3)throw new Error("InstanceNormalization requires 3 inputs.");const s=m[0],o=m[1],c=m[2];if(s.dims.length<3||o.dims.length!==1||c.dims.length!==1)throw new Error("Invalid input shape.");if(o.dims[0]!==s.dims[1]||c.dims[0]!==s.dims[1])throw new Error("Input shapes are mismatched.");if(s.type!=="float32"&&s.type!=="float64"||o.type!=="float32"&&o.type!=="float64"||c.type!=="float32"&&c.type!=="float64")throw new Error("Invalid input type.");if(m[0].dims.length!==4)throw new Error("Only support 4-D input shape.")}},708:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPackedMatmulProgramInfoLoader=void 0;const n=t(2517),i=t(5060),a=t(2039),l=t(9390),u=t(2823),d=t(5623);e.createPackedMatmulProgramInfoLoader=(f,m,s)=>{const o=(c=m.length>2,v=s.activationCacheKey,{name:"MatMul (packed)",inputNames:c?["A","B","Bias"]:["A","B"],inputTypes:c?[a.TextureType.packed,a.TextureType.packed,a.TextureType.packed]:[a.TextureType.packed,a.TextureType.packed],cacheHint:v});var c,v;return Object.assign(Object.assign({},o),{get:()=>((y,_,b,x)=>{const w=b.length>2,S=w?"value += getBiasForMatmul();":"",T=b[0].dims,E=b[1].dims,M=n.BroadcastUtil.calcShape(T,E,!0),P=!n.ShapeUtil.areEqual(b[0].dims,b[1].dims);if(!M)throw new Error("Can't use matmul on the given tensors");const A=T[T.length-1],C=Math.ceil(A/2),D=T.length,k=E.length,j=(0,i.getGlsl)(y.session.backend.glContext.version),I=(0,l.getCoordsDataType)(M.length),W=M.length,L=(0,l.getGlChannels)(),{activationFunction:U,applyActivation:H}=(0,u.getActivationSnippet)(x),Y=w?`${(0,d.getBiasForMatmul)(I,L,b[2].dims,M,!0)}`:"",B=P?`${function(_e,fe,We,ft){let Te=[],G=[];const K=We[0].dims,ue=We[1].dims,ke=K.length,Ie=ue.length,F=ft.length,ge=F-ke,le=F-Ie;Te=K.map((be,pt)=>`coords.${fe[pt+ge]}`),Te[ke-1]="i*2",Te.join(", "),G=ue.map((be,pt)=>`coords.${fe[pt+le]}`),G[Ie-2]="i*2",G.join(", ");const te=n.BroadcastUtil.getBroadcastDims(K,ft),oe=n.BroadcastUtil.getBroadcastDims(ue,ft),pe=te.map(be=>`coords.${fe[be+ge]} = 0;`).join(` -`),Be=oe.map(be=>`coords.${fe[be+le]} = 0;`).join(` -`),ze=`int lastDim = coords.${fe[F-1]}; - coords.${fe[F-1]} = coords.${fe[F-2]}; - coords.${fe[F-2]} = lastDim;`;return` -vec4 getAAtOutCoordsMatmul(int i) { - ${_e} coords = getOutputCoords(); - ${ze} - ${pe} - vec4 outputValue = getA(${Te}); - return outputValue; -} - -vec4 getBAtOutCoordsMatmul(int i) { - ${_e} coords = getOutputCoords(); - ${ze} - ${Be} - vec4 outputValue = getB(${G}); - return outputValue; -}`}(I,L,b,M)}`:"",X=P?"getAAtOutCoordsMatmul(i)":`getA(${function(_e,fe){let We="";for(let ft=0;ft{Object.defineProperty(e,"__esModule",{value:!0}),e.getBiasForMatmul=e.createMatmulProgramInfoLoader=e.parseMatMulAttributes=e.matMul=void 0;const n=t(2517),i=t(2039),a=t(9390),l=t(2823),u=t(708);function d(s,o){const c=(v=s.length>2,y=o.activationCacheKey,{name:"MatMul",inputNames:v?["A","B","Bias"]:["A","B"],inputTypes:v?[i.TextureType.unpacked,i.TextureType.unpacked,i.TextureType.unpacked]:[i.TextureType.unpacked,i.TextureType.unpacked],cacheHint:y});var v,y;return Object.assign(Object.assign({},c),{get:()=>function(_,b,x){const w=b[0].dims,S=b[1].dims,T=n.BroadcastUtil.calcShape(w,S,!0);if(!T)throw new Error("Can't use matmul on the given tensors");const E=(0,a.getCoordsDataType)(T.length),M=(0,a.getGlChannels)(),{activationFunction:P,applyActivation:A}=(0,l.getActivationSnippet)(x),C=b.length>2,D=C?"value += getBiasForMatmul();":"",k=C?`${m(E,M,b[2].dims,T,!1)}`:"",j=T.length,I=w.length,W=S.length,L=` - ${P} - ${k} - float process(int indices[${j}]) { - int a[${I}]; - int b[${W}]; - bcastMatmulIndices_A(indices, a); - bcastMatmulIndices_B(indices, b); - - float value; - for (int k=0; k<${w[w.length-1]}; ++k) { - a[${I-1}] = k; - b[${W-2}] = k; - value += _A(a) * _B(b); - } - ${D} - ${A} - return value; - }`;return Object.assign(Object.assign({},_),{output:{dims:T,type:b[0].type,textureType:i.TextureType.unpacked},shaderSource:L})}(c,s,o)})}e.matMul=(s,o,c)=>(f(o),s.session.pack?[s.run((0,u.createPackedMatmulProgramInfoLoader)(s,o,c),o)]:[s.run(d(o,c),o)]),e.parseMatMulAttributes=s=>(0,l.parseInternalActivationAttributes)(s.attributes),e.createMatmulProgramInfoLoader=d;const f=s=>{if(!s||s.length!==2)throw new Error("MatMul requires 2 inputs.");if(s[0].dims[s[0].dims.length-1]!==s[1].dims[s[1].dims.length-2])throw new Error("shared dimension does not match.");if(s[0].type!=="float32"&&s[0].type!=="float64"||s[1].type!=="float32"&&s[1].type!=="float64")throw new Error("inputs should be float type");if(s[0].type!==s[1].type)throw new Error("inputs types should match")};function m(s,o,c,v,y){let _="";const b=c.length,x=v.length,w=x-b;_=x<2&&b>0?"coords":c.map((E,M)=>`coords.${o[M+w]}`).join(", ");const S=n.BroadcastUtil.getBroadcastDims(c,v).map(E=>`coords.${o[E+w]} = 0;`).join(` -`);let T="vec4(outputValue.xx, outputValue.yy)";return n.ShapeUtil.size(c)===1&&(T="vec4(outputValue.x)"),y?` -vec4 getBiasForMatmul() { - ${s} coords = getOutputCoords(); - ${S} - vec4 outputValue = getBias(${_}); - return ${T}; -}`:` -float getBiasForMatmul() { - ${s} coords = getOutputCoords(); - ${S} - return getBias(coords.x); -}`}e.getBiasForMatmul=m},2403:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPackProgramInfoLoader=void 0;const n=t(5060),i=t(2039),a=t(9390),l=t(2827),u={name:"pack",inputNames:["A"],inputTypes:[i.TextureType.unpackedReversed]};e.createPackProgramInfoLoader=(d,f)=>Object.assign(Object.assign({},u),{get:()=>((m,s)=>{const o=(0,n.getGlsl)(m.session.backend.glContext.version),c=s.dims,v=c.length,y=s.dims.length,_=(0,a.getCoordsDataType)(y),b=(0,l.getChannels)("rc",y),x=(w=y,S=b,T=c[c.length-2],E=c[c.length-1],w===0||w===1?"":` - int r = ${S[w-2]}; - int c = ${S[w-1]}; - int rp1 = ${S[w-2]} + 1; - int cp1 = ${S[w-1]} + 1; - bool rEdge = rp1 >= ${E}; - bool cEdge = cp1 >= ${T}; - `);var w,S,T,E;let M;M=v===0?[1,1]:v===1?[c[0],1]:[c[y-1],c[y-2]];const P=function(D,k,j){if(D===0)return"false";if(D===1)return`rc > ${k[0]}`;let I="";for(let W=D-2;W= ${k[W-D+2]}`,W= ${D[0]} ? 0. : getA(rc + 1), - 0, 0`;let I="";if(j>2)for(let W=0;W{Object.defineProperty(e,"__esModule",{value:!0}),e.unpackFromChannel=e.getChannels=e.getVecChannels=void 0;const n=t(9390);function i(a,l){return(0,n.getGlChannels)(l).map(u=>`${a}.${u}`)}e.getVecChannels=i,e.getChannels=function(a,l){return l===1?[a]:i(a,l)},e.unpackFromChannel=function(){return` - float getChannel(vec4 frag, int dim) { - int modCoord = imod(dim, 2); - return modCoord == 0 ? frag.r : frag.g; - } - - float getChannel(vec4 frag, vec2 innerDims) { - vec2 modCoord = mod(innerDims, 2.); - return modCoord.x == 0. ? - (modCoord.y == 0. ? frag.r : frag.g) : - (modCoord.y == 0. ? frag.b : frag.a); - } - `}},2870:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parsePadAttributesV11=e.padV11=e.parsePadAttributesV2=e.padV2=void 0;const n=t(246),i=t(2517),a=t(5060),l=t(2039),u={name:"Pad",inputNames:["A"],inputTypes:[l.TextureType.unpacked]};e.padV2=(_,b,x)=>(m(b),[_.run(Object.assign(Object.assign({},u),{cacheHint:x.cacheKey,get:()=>f(_,b[0],x)}),b)]),e.parsePadAttributesV2=_=>{const b=_.attributes.getString("mode","constant"),x=_.attributes.getFloat("value",0),w=_.attributes.getInts("pads");return(0,n.createAttributeWithCacheKey)({mode:b,value:x,pads:w})},e.padV11=(_,b,x)=>{s(b);const w=d(_,b,x);return(0,e.padV2)(_,[b[0]],w)},e.parsePadAttributesV11=_=>_.attributes.getString("mode","constant");const d=(_,b,x)=>{if(!_.session.isInitializer(b[1].dataId)||b.length>=3&&!_.session.isInitializer(b[2].dataId))throw new Error("dynamic pad attributes are not allowed");const w=Array.from(b[1].integerData),S=b.length>=3?b[2].floatData[0]:0;return(0,n.createAttributeWithCacheKey)({mode:x,pads:w,value:S})},f=(_,b,x)=>{const w=i.ShapeUtil.padShape(b.dims.slice(),x.pads),S=w.length,T=` - ${o(_,b,x)} - float process(int[${S}] indices) { - return padA(indices); - }`;return{name:"Pad",inputNames:["A"],inputTypes:[l.TextureType.unpacked],output:{dims:w,type:b.type,textureType:l.TextureType.unpacked},shaderSource:T}},m=_=>{if(!_||_.length!==1)throw new Error("Pad requires 1 input");if(_[0].type!=="float32"&&_[0].type!=="float64")throw new Error("Invalid input type.")},s=_=>{if(!_||_.length!==2&&_.length!==3)throw new Error("Pad requires 2 or 3 inputs");if(_[1].type!=="int32")throw new Error("Invalid input type.");if(_.length>=3&&_[2].type==="string")throw new Error("Invalid input type.")},o=(_,b,x)=>{const w=(0,a.getGlsl)(_.session.backend.glContext.version),[S,T]=_.calculateTextureWidthAndHeight(b.dims,l.TextureType.unpacked),E=i.ShapeUtil.computeStrides(b.dims);switch(x.mode){case"constant":return c(w,b.dims,E,S,T,x.pads,x.value);case"reflect":return v(w,b.dims,E,S,T,x.pads);case"edge":return y(w,b.dims,E,S,T,x.pads);default:throw new Error("Invalid mode")}},c=(_,b,x,w,S,T,E)=>{const M=b.length;let P="";for(let A=M-1;A>=0;--A)P+=` - k = m[${A}] - ${T[A]}; - if (k < 0) return constant; - if (k >= ${b[A]}) return constant; - offset += k * ${x[A]}; - `;return` - float padA(int m[${M}]) { - const float constant = float(${E}); - int offset = 0; - int k = 0; - ${P} - vec2 coords = offsetToCoords(offset, ${w}, ${S}); - float value = getColorAsFloat(${_.texture2D}(A, coords)); - return value; - } - `},v=(_,b,x,w,S,T)=>{const E=b.length;let M="";for(let P=E-1;P>=0;--P)M+=` - k = m[${P}] - ${T[P]}; - if (k < 0) { k = -k; } - { - const int _2n_1 = ${2*(b[P]-1)}; - k = int( mod( float(k), float(_2n_1) ) ) ; - if(k >= ${b[P]}) { k = _2n_1 - k; } - } - offset += k * ${x[P]}; - `;return` - float padA(int m[${E}]) { - int offset = 0; - int k = 0; - ${M} - vec2 coords = offsetToCoords(offset, ${w}, ${S}); - float value = getColorAsFloat(${_.texture2D}(A, coords)); - return value; - } - `},y=(_,b,x,w,S,T)=>{const E=b.length;let M="";for(let P=E-1;P>=0;--P)M+=` - k = m[${P}] - ${T[P]}; - if (k < 0) k = 0; - if (k >= ${b[P]}) k = ${b[P]-1}; - offset += k * ${x[P]}; - `;return` - float padA(int m[${E}]) { - int offset = 0; - int k = 0; - ${M} - vec2 coords = offsetToCoords(offset, ${w}, ${S}); - float value = getColorAsFloat(${_.texture2D}(A, coords)); - return value; - } - `}},2143:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.globalMaxPool=e.parseMaxPoolAttributes=e.maxPool=e.parseGlobalAveragePoolAttributes=e.globalAveragePool=e.parseAveragePoolAttributes=e.averagePool=void 0;const n=t(246),i=t(2517),a=t(2039);e.averagePool=(y,_,b)=>{s(_);const x={name:"AveragePool",inputNames:["X"],inputTypes:[a.TextureType.unpacked],cacheHint:b.cacheKey};return[y.run(Object.assign(Object.assign({},x),{get:()=>l(_,x,!1,b)}),_)]},e.parseAveragePoolAttributes=y=>{const _=y.attributes.getString("auto_pad","NOTSET"),b=y.attributes.getInt("ceil_mode",0),x=y.attributes.getInt("count_include_pad",0)!==0,w=y.attributes.getInts("kernel_shape"),S=y.attributes.getInts("strides",[]),T=y.attributes.getInts("pads",[]);if(b!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");return(0,n.createAttributeWithCacheKey)({autoPad:_,ceilMode:b,countIncludePad:x,kernelShape:w,strides:S,pads:T})};const l=(y,_,b,x)=>{const[w,S]=d(y,x,b),T=i.ShapeUtil.size(w.kernelShape);let E="";w.countIncludePad?E+=`value /= float(${T});`:E+=`value /= float(${T} - pad);`;const M=` - ${o(y[0].dims,w,"value += _X(x);",E,"0.0")} - `;return Object.assign(Object.assign({},_),{output:{dims:S,type:y[0].type,textureType:a.TextureType.unpacked},shaderSource:M})};e.globalAveragePool=(y,_,b)=>{s(_);const x={name:"GlobalAveragePool",inputNames:["X"],inputTypes:[a.TextureType.unpacked],cacheHint:`${b.countIncludePad}`};return[y.run(Object.assign(Object.assign({},x),{get:()=>l(_,x,!0,b)}),_)]},e.parseGlobalAveragePoolAttributes=y=>{const _=y.attributes.getInt("count_include_pad",0)!==0;return(0,n.createAttributeWithCacheKey)({autoPad:"",ceilMode:0,countIncludePad:_,kernelShape:[],strides:[],pads:[]})},e.maxPool=(y,_,b)=>{s(_);const x={name:"MaxPool",inputNames:["X"],inputTypes:[a.TextureType.unpacked],cacheHint:b.cacheKey};return[y.run(Object.assign(Object.assign({},x),{get:()=>u(_,x,!1,b)}),_)]},e.parseMaxPoolAttributes=y=>{const _=y.attributes.getString("auto_pad","NOTSET"),b=y.attributes.getInt("ceil_mode",0),x=y.attributes.getInts("kernel_shape"),w=y.attributes.getInts("strides",[]),S=y.attributes.getInts("pads",[]),T=y.attributes.getInt("storage_order",0),E=y.attributes.getInts("dilations",[]);if(T!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(b!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");return(0,n.createAttributeWithCacheKey)({autoPad:_,ceilMode:b,countIncludePad:!1,kernelShape:x,strides:w,pads:S,storageOrder:T,dilations:E})};const u=(y,_,b,x)=>{const[w,S]=d(y,x,b),T=` - ${o(y[0].dims,w,` - value = max(_X(x), value); - `,"","-1e5")} - `;return Object.assign(Object.assign({},_),{output:{dims:S,type:y[0].type,textureType:a.TextureType.unpacked},shaderSource:T})},d=(y,_,b)=>{const x=y[0].dims.slice(),w=Object.hasOwnProperty.call(_,"dilations"),S=_.kernelShape.slice(),T=_.strides.slice(),E=w?_.dilations.slice():[],M=_.pads.slice();i.PoolConvUtil.adjustPoolAttributes(b,x,S,T,E,M);const P=i.PoolConvUtil.computePoolOutputShape(b,x,T,E,S,M,_.autoPad),A=Object.assign({},_);return w?Object.assign(A,{kernelShape:S,strides:T,pads:M,dilations:E,cacheKey:_.cacheKey}):Object.assign(A,{kernelShape:S,strides:T,pads:M,cacheKey:_.cacheKey}),[A,P]},f={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[],cacheKey:""},m={name:"GlobalMaxPool",inputNames:["X"],inputTypes:[a.TextureType.unpacked]};e.globalMaxPool=(y,_)=>(s(_),[y.run(Object.assign(Object.assign({},m),{get:()=>u(_,m,!0,f)}),_)]);const s=y=>{if(!y||y.length!==1)throw new Error("Pool ops requires 1 input.");if(y[0].type!=="float32"&&y[0].type!=="float64")throw new Error("Invalid input type.")},o=(y,_,b,x,w)=>{const S=y.length;if(_.kernelShape.length<=2){const T=_.kernelShape[_.kernelShape.length-1],E=_.strides[_.strides.length-1],M=_.pads[_.pads.length/2-1],P=_.pads[_.pads.length-1],A=y[S-1];let C="",D="",k="";if(C=M+P!==0?` - for (int i = 0; i < ${T}; i++) { - x[${S} - 1] = indices[${S} - 1] * ${E} - ${M} + i; - if (x[${S} - 1] < 0 || x[${S} - 1] >= ${A}) { - pad++; - continue; - } - ${b} - }`:` - for (int i = 0; i < ${T}; i++) { - x[${S} - 1] = indices[${S} - 1] * ${E} - ${M} + i; - ${b} - }`,_.kernelShape.length===2){const j=_.kernelShape[_.kernelShape.length-2],I=_.strides[_.strides.length-2],W=_.pads[_.pads.length/2-2],L=_.pads[_.pads.length-2],U=y[S-2];D=W+L!==0?` - for (int j = 0; j < ${j}; j++) { - x[${S} - 2] = indices[${S} - 2] * ${I} - ${W} + j; - if (x[${S} - 2] < 0 || x[${S} - 2] >= ${U}) { - pad+= ${T}; - continue; - } - `:` - for (int j = 0; j < ${j}; j++) { - x[${S} - 2] = indices[${S} - 2] * ${I} - ${W} + j; - `,k=` - } - `}return` - float process(int indices[${S}]) { - int x[${S}]; - copyVec(indices, x); - - float value = ${w}; - int pad = 0; - ${D} - ${C} - ${k} - ${x} - return value; - } - `}{const T=i.ShapeUtil.size(_.kernelShape),E=i.ShapeUtil.computeStrides(_.kernelShape),M=E.length,P=_.pads.length,A=v(M),C=c(y,"inputDims"),D=c(_.pads,"pads"),k=c(E,"kernelStrides"),j=c(_.strides,"strides");let I="";return I=_.pads.reduce((W,L)=>W+L)?` - if (x[j] >= inputDims[j] || x[j] < 0) { - pad++; - isPad = true; - break; - } - } - if (!isPad) { - ${b} - }`:` - } - ${b} - `,` - ${A} - float process(int indices[${S}]) { - int x[${S}]; - copyVec(indices, x); - int offset[${M}]; - int pads[${P}]; - int inputDims[${S}]; - int kernelStrides[${M}]; - int strides[${M}]; - ${D} - ${C} - ${j} - ${k} - - float value = ${w}; - int pad = 0; - bool isPad = false; - for (int i = 0; i < ${T}; i++) { - offsetToIndices(i, kernelStrides, offset); - isPad = false; - for (int j = ${S} - ${M}; j < ${S}; j++) { - x[j] = indices[j] * strides[j - ${S} + ${M}] - + offset[j - ${S} + ${M}] - pads[j - 2]; - ${I} - } - ${x} - - return value; - } - `}},c=(y,_)=>{let b="";for(let x=0;x` - void offsetToIndices(int offset, int[${y}] strides, out int[${y}] indices) { - if (${y} == 0) { - return; - } - for (int i = 0; i < ${y} - 1; ++i) { - indices[i] = offset / strides[i]; - offset -= indices[i] * strides[i]; - } - indices[${y} - 1] = offset; - }`},4939:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reduceLogSumSquare=e.reduceLogSum=e.reduceProd=e.reduceMin=e.reduceMax=e.reduceMean=e.reduceSum=e.parseReduceAttributes=void 0;const n=t(246),i=t(782),a=t(2517),l=t(2039),u=(m,s,o,c,v)=>{f(s);const y={name:c,inputNames:["A"],inputTypes:[l.TextureType.unpacked]};return[m.run(Object.assign(Object.assign({},y),{cacheHint:o.cacheKey,get:()=>d(m,s,o,c,v,y)}),s)]};e.parseReduceAttributes=m=>{const s=m.attributes.getInts("axes",[]),o=m.attributes.getInt("keepdims",1)===1;return(0,n.createAttributeWithCacheKey)({axes:s,keepDims:o})};const d=(m,s,o,c,v,y)=>{const _=[],b=s[0].dims.length||1,x=[],w=a.ShapeUtil.normalizeAxes(o.axes,s[0].dims.length),S=v(s,w);let T=S[1];for(let M=0;M=0||w.length===0?(o.keepDims&&_.push(1),T=` - for(int j${M} = 0; j${M} < ${s[0].dims[M]}; j${M}++) { - inputIdx[${M}] = j${M}; - ${T} - }`):(x.push(`inputIdx[${M}] = outputIdx[${_.length}];`),_.push(s[0].dims[M]));const E=` - float process(int outputIdx[${_.length||1}]) { - float value; // final result - int inputIdx[${b}]; // addressing input data - ${x.join(` -`)} - ${S[0]} // init ops for reduce max/min - ${T} - ${S[2]} // final computation for reduce mean - return value; - }`;return Object.assign(Object.assign({},y),{output:{dims:_,type:s[0].type,textureType:l.TextureType.unpacked},shaderSource:E})},f=m=>{if(!m||m.length!==1)throw new Error("Reduce op requires 1 input.");if(i.NUMBER_TYPES.indexOf(m[0].type)===-1)throw new Error("Invalid input type.")};e.reduceSum=(m,s,o)=>u(m,s,o,"ReduceSum",()=>["value = 0.0;","value += _A(inputIdx);",""]),e.reduceMean=(m,s,o)=>u(m,s,o,"ReduceMean",(c,v)=>{let y=1;for(let _=0;_=0||v.length===0)&&(y*=c[0].dims[_]);return["value = 0.0;","value += _A(inputIdx);",`value /= ${y}.;`]}),e.reduceMax=(m,s,o)=>u(m,s,o,"ReduceMax",(c,v)=>{const y=[];for(let _=0;_=0||v.length===0)&&y.push(`inputIdx[${_}] = 0;`);return[`${y.join(` -`)} -value = _A(inputIdx);`,"value = max(value, _A(inputIdx));",""]}),e.reduceMin=(m,s,o)=>u(m,s,o,"ReduceMin",(c,v)=>{const y=[];for(let _=0;_=0||v.length===0)&&y.push(`inputIdx[${_}] = 0;`);return[`${y.join(` -`)} -value = _A(inputIdx);`,"value = min(value, _A(inputIdx));",""]}),e.reduceProd=(m,s,o)=>u(m,s,o,"ReduceProd",()=>["value = 1.0;","value *= _A(inputIdx);",""]),e.reduceLogSum=(m,s,o)=>u(m,s,o,"ReduceLogSum",()=>["value = 0.0;","value += _A(inputIdx);","value = log(value);"]),e.reduceLogSumSquare=(m,s,o)=>u(m,s,o,"ReduceLogSumSquare",()=>["float t; value = 0.0;","t = _A(inputIdx); value += t * t;",""])},7019:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isReshapeCheap=e.processDims3D=e.createPackedReshape3DProgramInfoLoader=void 0;const n=t(2517),i=t(5060),a=t(2039),l=t(2827);e.createPackedReshape3DProgramInfoLoader=(u,d,f)=>{const m=(s=>({name:"Reshape (packed)",inputTypes:[a.TextureType.packed],inputNames:["A"],cacheHint:`${s}`}))(f);return Object.assign(Object.assign({},m),{get:()=>((s,o,c,v)=>{const y=o.dims,_=v;let b="";for(let S=0;S<4;S++){let T="";switch(S){case 0:T="outputCoords = rc;";break;case 1:T="outputCoords = ivec3(rc.x, rc.y+1, rc.z);";break;case 2:T="outputCoords = ivec3(rc.x, rc.y, rc.z+1);";break;case 3:T="outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);";break;default:throw new Error}b+=` - ${T} - ${S>0?"if(outputCoords.y < rows && outputCoords.z < cols){":""} - int flattenedIndex = getFlattenedIndex(outputCoords); - - ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex); - vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z)); - - result[${S}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims); - - ${S>0?"}":""} - `}const x=(0,i.getGlsl)(s.session.backend.glContext.version),w=` - ${function(S){const T=n.ShapeUtil.computeStrides(S),E=["b","r","c"],M="index";return` - ivec3 inputCoordsFromReshapedOutCoords(int index) { - ${T.map((P,A)=>`int ${E[A]} = ${M} / ${P}; ${A===T.length-1?`int ${E[A+1]} = ${M} - ${E[A]} * ${P}`:`index -= ${E[A]} * ${P}`};`).join("")} - return ivec3(b, r, c); - } - `}(y)} - ${function(S){const T=n.ShapeUtil.computeStrides(S);return` - int getFlattenedIndex(ivec3 coords) { - // reverse y, z order - return coords.x * ${T[0]} + coords.z * ${T[1]} + coords.y; - } -`}(_)} - ${(0,l.unpackFromChannel)()} - - void main() { - ivec3 rc = getOutputCoords(); - - vec4 result = vec4(0.0); - - ivec3 outputCoords; - int rows = ${_[2]}; - int cols = ${_[1]}; - - ${b} - ${x.output} = result; - } - `;return Object.assign(Object.assign({},c),{output:{dims:_,type:o.type,textureType:a.TextureType.packed},shaderSource:w,hasMain:!0})})(u,d,m,f)})},e.processDims3D=function(u){if(u.length===0)return[1,1,1];let d=1;for(let f=0;f1?u[u.length-2]:1,u[u.length-1]]},e.isReshapeCheap=function(u,d){let f=!1;return f=u.length===0||d.length===0||(u.length<2||d.length<2?u[u.length-1]===d[d.length-1]:u[u.length-1]===d[d.length-1]&&u[u.length-2]===d[d.length-2]),f}},718:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reshape=void 0;const n=t(2517);e.reshape=(i,a)=>{const l=n.ShapeUtil.calculateReshapedDims(a[0].dims,a[1].integerData);return i.session.pack?[i.reshapePacked(a[0],l)]:[i.reshapeUnpacked(a[0],l)]}},2268:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseResizeAttributesV11=e.parseResizeAttributesV10=e.resize=void 0;const n=t(5060),i=t(2039),a=t(9390),l=t(2827),u=t(9793),d={name:"Resize",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.resize=(c,v,y)=>((0,u.validateInputs)(v,y),[c.run(Object.assign(Object.assign({},d),{cacheHint:y.cacheKey,get:()=>f(c,v,y)}),v)]),e.parseResizeAttributesV10=c=>(0,u.parseUpsampleAttributes)(c,10),e.parseResizeAttributesV11=c=>(0,u.parseUpsampleAttributes)(c,11);const f=(c,v,y)=>{const _=(0,n.getGlsl)(c.session.backend.glContext.version),[b,x]=m(v,y);if(b.every(I=>I===1)&&y.coordinateTransformMode!=="tf_crop_and_resize")return Object.assign(Object.assign({},d),{output:{dims:x,type:v[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:`void main() { - vec4 v = ${_.texture2D}(X, TexCoords); - ${_.output} = v; - }`});const w=x.length;if(w<2)throw new Error(`output dimension should be at least 2, but got ${w}`);const S=x[w-2],T=x[w-1],E=v[0].dims;if(w!==E.length)throw new Error(`output dimension should match input ${E.length}, but got ${w}`);const M=E[w-2],P=E[w-1],A=b[w-2],C=b[w-1];let D="";if(y.mode!=="linear")throw new Error(`resize (packed) does not support mode: '${y.mode}'`);switch(y.coordinateTransformMode){case"asymmetric":D=` - vec4 getSourceFracIndex(ivec4 coords) { - return vec4(coords) / scaleWHWH; - } - `;break;case"half_pixel":D=` - vec4 getSourceFracIndex(ivec4 coords) { - return (vec4(coords) + 0.5) / scaleWHWH - 0.5; - } - `;break;case"pytorch_half_pixel":D=` - vec4 getSourceFracIndex(ivec4 coords) { - vec4 fcoords = vec4(coords); - return vec4( - ${T}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0, - ${S}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0, - ${T}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0, - ${S}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0 - ); - } - `;break;case"align_corners":D=` - vec4 getSourceFracIndex(ivec4 coords) { - vec4 resized = vec4(${T}.0 - 1.0, ${S}.0 - 1.0, ${T}.0 - 1.0, - ${S}.0 - 1.0); - vec4 original = vec4(${P}.0 - 1.0, ${M}.0 - 1.0, ${P}.0 - 1.0, - ${M}.0 - 1.0); - vec4 new_scale = original / resized; - return vec4(coords) * new_scale; - } - `;break;default:throw new Error(`resize (packed) does not support coordinateTransformMode: '${y.coordinateTransformMode}'`)}const k=(0,a.getCoordsDataType)(w),j=` - const vec2 inputWH = vec2(${M}.0, ${P}.0); - const vec4 scaleWHWH = vec4(float(${A}), float(${C}), float(${A}), float(${C})); - ${(0,l.unpackFromChannel)()} - ${D} - float getAValue(int x10, int r, int c, int d) { - return getChannel(getA(x10, r, c, d), vec2(c, d)); - } - void main() { - ${k} rc = getOutputCoords(); - - int batch = rc[0]; - int depth = rc[1]; - - // retrieve the 4 coordinates that is used in the 4 packed output values. - ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1); - - // calculate the source index in fraction - vec4 sourceFrac = getSourceFracIndex(coords); - - // get the lower and upper bound of the 4 values that will be packed into one texel. - ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy))); - ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw))); - ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy))); - ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw))); - - bool hasNextRow = rc.w < ${S-1}; - bool hasNextCol = rc.z < ${T-1}; - - // pack x00, x01, x10, x11's top-left corner into one vec4 structure - vec4 topLeft = vec4( - getAValue(batch, depth, x00.x, x00.y), - hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0); - - // pack x00, x01, x10, x11's top-right corner into one vec4 structure - vec4 topRight = vec4( - getAValue(batch, depth, x00.x, x00.w), - hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0); - - // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure - vec4 bottomLeft = vec4( - getAValue(batch, depth, x00.z, x00.y), - hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0); - - // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure - vec4 bottomRight = vec4( - getAValue(batch, depth, x00.z, x00.w), - hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0, - hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0, - (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0); - - // calculate the interpolation fraction on u and v direction - vec4 frac = vec4(sourceFrac) - floor(sourceFrac); - vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0)); - - vec4 top = mix(topLeft, topRight, clampFrac.ywyw); - vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw); - vec4 newValue = mix(top, bottom, clampFrac.xxzz); - - ${_.output} = vec4(newValue); - } - `;return Object.assign(Object.assign({},d),{output:{dims:x,type:v[0].type,textureType:i.TextureType.packed},hasMain:!0,shaderSource:j})},m=(c,v)=>{const y=c[0].dims;let _,b=v.scales;if(b.length===0){const w=c[v.scalesInputIdx];if(w&&w.size!==0){if(c[v.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");b=s(w,v.mode,v.isResize)}else{const S=c[v.sizesInputIdx];if(!S||S.size===0)throw new Error("Either scales or sizes MUST be provided as input.");_=Array.from(S.integerData),b=o(_,y,v.mode,v.isResize)}}else if(c[v.sizesInputIdx])throw new Error("Only one of scales or sizes must be provided as input.");const x=_||y.map((w,S)=>Math.floor(w*b[S]));return[b,x]},s=(c,v,y)=>{const _=Array.from(c.floatData);return(0,u.scalesValidation)(_,v,y),_},o=(c,v,y,_)=>{const b=v.length,x=new Array(b);for(let w=0,S=b;w{Object.defineProperty(e,"__esModule",{value:!0}),e.shape=void 0;const n=t(9162);e.shape=(a,l)=>(i(l),[new n.Tensor([l[0].dims.length],"int32",void 0,void 0,new Int32Array(l[0].dims))]);const i=a=>{if(!a||a.length!==1)throw new Error("Shape requires 1 input.")}},2278:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sliceV10=e.parseSliceAttributes=e.slice=void 0;const n=t(246),i=t(782),a=t(2517),l=t(2039),u={name:"Slice",inputNames:["A"],inputTypes:[l.TextureType.unpacked]};e.slice=(o,c,v)=>(f(c),[o.run(Object.assign(Object.assign({},u),{cacheHint:v.cacheKey,get:()=>d(o,c[0],v)}),c)]),e.parseSliceAttributes=o=>{const c=o.attributes.getInts("starts"),v=o.attributes.getInts("ends"),y=o.attributes.getInts("axes",[]);return(0,n.createAttributeWithCacheKey)({starts:c,ends:v,axes:y})};const d=(o,c,v)=>{const y=v.axes.length===0?c.dims.slice(0).map((E,M)=>M):v.axes,_=a.ShapeUtil.normalizeAxes(y,c.dims.length),b=v.starts.map((E,M)=>E>c.dims[_[M]]-1?c.dims[_[M]]:a.ShapeUtil.normalizeAxis(E,c.dims[_[M]])),x=v.ends.map((E,M)=>E>c.dims[_[M]]-1?c.dims[_[M]]:a.ShapeUtil.normalizeAxis(E,c.dims[_[M]])),w=c.dims.slice(),S=[];for(let E=0;E<_.length;E++)w[_[E]]=x[E]-b[E],b[E]>0&&S.push(`outputIdx[${_[E]}] += ${b[E]};`);const T=` - float process(int outputIdx[${w.length}]) { - ${S.join(` - `)} - return _A(outputIdx); - }`;return Object.assign(Object.assign({},u),{output:{dims:w,type:c.type,textureType:l.TextureType.unpacked},shaderSource:T})},f=o=>{if(!o||o.length!==1)throw new Error("Slice requires 1 input.");if(i.NUMBER_TYPES.indexOf(o[0].type)===-1)throw new Error("Invalid input type.")};e.sliceV10=(o,c)=>{s(c);const v=m(o,c);return[o.run(Object.assign(Object.assign({},u),{cacheHint:v.cacheKey,get:()=>d(o,c[0],v)}),[c[0]])]};const m=(o,c)=>{if(!o.session.isInitializer(c[1].dataId)||!o.session.isInitializer(c[2].dataId)||c.length>=4&&!o.session.isInitializer(c[3].dataId)||c.length>=5&&!o.session.isInitializer(c[4].dataId))throw new Error("dynamic slice attributes are not allowed");if(c.length>=5&&c[4].integerData.some(b=>b!==1))throw new Error("currently non-1 steps is not supported for Slice");const v=Array.from(c[1].integerData),y=Array.from(c[2].integerData),_=c.length>=4?Array.from(c[3].integerData):[];return{starts:v,ends:y,axes:_,cacheKey:`${_};${v};${y}`}},s=o=>{if(!o||o.length<3||o.length>5)throw new Error("Invalid input number.");if(o[1].type!=="int32"||o[1].dims.length!==1)throw new Error("Invalid input type.");if(o[2].type!=="int32"||o[2].dims.length!==1)throw new Error("Invalid input type.");if(o.length>=4&&(o[3].type!=="int32"||o[3].dims.length!==1))throw new Error("Invalid input type.");if(o.length>=5&&(o[4].type!=="int32"||o[4].dims.length!==1))throw new Error("Invalid input type.")}},5524:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.softmaxV13=e.parseSoftmaxAttributesV13=e.parseSoftmaxAttributes=e.softmax=void 0;const n=t(246),i=t(2517),a=t(5060),l=t(2039),u=t(3738),d={name:"SoftmaxComputeMax",inputNames:["A"],inputTypes:[l.TextureType.unpacked]},f={name:"SoftmaxComputeScale",inputNames:["A","Max"],inputTypes:[l.TextureType.unpacked,l.TextureType.unpacked]},m={name:"SoftMax",inputNames:["A","Max","Norm"],inputTypes:[l.TextureType.unpacked,l.TextureType.unpacked,l.TextureType.unpacked]};e.softmax=(_,b,x)=>{y(b);const w=b[0].dims.slice(),S=i.ShapeUtil.normalizeAxis(x.axis,w.length),T=i.ShapeUtil.sizeToDimension(w,S),E=i.ShapeUtil.sizeFromDimension(w,S);return s(_,b,x,T,E)},e.parseSoftmaxAttributes=_=>(0,n.createAttributeWithCacheKey)({axis:_.attributes.getInt("axis",1)}),e.parseSoftmaxAttributesV13=_=>(0,n.createAttributeWithCacheKey)({axis:_.attributes.getInt("axis",-1)}),e.softmaxV13=(_,b,x)=>{y(b);const w=b[0].dims.slice(),S=i.ShapeUtil.normalizeAxis(x.axis,w.length),T=w.length,E=S!==T-1,M=[];let P,A=[],C=[];E&&(A=Array.from({length:T}).map((I,W)=>W),A[S]=T-1,A[T-1]=S,A.map(I=>M.push(w[I])),P=(0,n.createAttributeWithCacheKey)({perm:A}),C=(0,u.transpose)(_,b,P));const D=E?i.ShapeUtil.sizeToDimension(M,T-1):i.ShapeUtil.sizeToDimension(w,T-1),k=E?i.ShapeUtil.sizeFromDimension(M,T-1):i.ShapeUtil.sizeFromDimension(w,T-1),j=s(_,E?C:b,x,D,k);return E?(0,u.transpose)(_,j,P):j};const s=(_,b,x,w,S)=>{const T=o(_,b[0],w,S,[w]),E=_.run(Object.assign(Object.assign({},d),{cacheHint:x.cacheKey,get:()=>T}),b),M=c(_,b[0],w,S,T.output.dims,[w]),P=_.run(Object.assign(Object.assign({},f),{cacheHint:x.cacheKey,get:()=>M}),[b[0],E]),A=v(_,b[0],w,S,T.output.dims,M.output.dims);return[_.run(Object.assign(Object.assign({},m),{cacheHint:x.cacheKey,get:()=>A}),[b[0],E,P])]},o=(_,b,x,w,S)=>{const[T,E]=_.calculateTextureWidthAndHeight(b.dims,l.TextureType.unpacked),M=S.length;if(x<1||w<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(S.length!==1)throw new Error("Dimensionality of the output should be 1");if(S[0]!==x)throw new Error("Shape of the output should be equal to logical row count");const P=(0,a.getGlsl)(_.session.backend.glContext.version),A=` - float process(int[${M}] indices) { - int logical_row_start_offset = indices[0] * ${w}; - - float max = getColorAsFloat(${P.texture2D}(A, offsetToCoords(logical_row_start_offset, ${T}, - ${E} ))); - for(int i=1; i<${w}; ++i) - { - float current = getColorAsFloat(${P.texture2D}(A, offsetToCoords(logical_row_start_offset + i, - ${T}, ${E}))); - if(current > max) - max = current; - } - - return max; - }`;return Object.assign(Object.assign({},d),{output:{dims:S,type:b.type,textureType:l.TextureType.unpacked},shaderSource:A})},c=(_,b,x,w,S,T)=>{const[E,M]=_.calculateTextureWidthAndHeight(b.dims,l.TextureType.unpacked),P=T.length;if(x<1||w<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(T.length!==1)throw new Error("Dimensionality of the output should be 1");if(T[0]!==x)throw new Error("Shape of the output should be equal to logical row count");if(S.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(S[0]!==x)throw new Error("Shape of the intermediate results should be equal to logical row count");const A=` - float process(int[${P}] indices) { - int logical_row_start_offset = indices[0] * ${w}; - - float norm_factor = 0.0; - float max = _Max(indices); - for(int i=0; i<${w}; ++i) - { - norm_factor += exp(getColorAsFloat(${(0,a.getGlsl)(_.session.backend.glContext.version).texture2D}(A, offsetToCoords(logical_row_start_offset + i, - ${E}, ${M}))) - max); - } - - return norm_factor; - }`;return Object.assign(Object.assign({},f),{output:{dims:T,type:b.type,textureType:l.TextureType.unpacked},shaderSource:A})},v=(_,b,x,w,S,T)=>{const[E,M]=_.calculateTextureWidthAndHeight(b.dims,l.TextureType.unpacked),P=b.dims.length;if(x<1||w<1)throw new Error("Logical row count N and feature count D must be greater than or equal to 1");if(S.length!==1||T.length!==1)throw new Error("Dimensionality of the intermediate results should be 1");if(S[0]!==x||T[0]!==x)throw new Error("Shape of the intermediate results should be equal to logical row count");const A=` - float process(int[${P}] indices) { - - // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords) - int offset = coordsToOffset(TexCoords, ${E}, ${M}); - - //determine the logical row for this index - int logical_row_index[1]; - logical_row_index[0] = offset / ${w}; - - float norm_factor = _Norm(logical_row_index); - - // avoid possible division by 0 - // if norm_facor is 0, all elements are zero - // if so, return 0 - if(norm_factor == 0.0) - return 0.0; - - return exp(_A(indices) - _Max(logical_row_index)) / norm_factor; - }`;return Object.assign(Object.assign({},m),{output:{dims:b.dims,type:b.type,textureType:l.TextureType.unpacked},shaderSource:A})},y=_=>{if(!_||_.length!==1)throw new Error("Softmax requires 1 input.");if(_[0].type!=="float32"&&_[0].type!=="float64")throw new Error("Invalid input type")}},5975:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseSplitAttributes=e.split=void 0;const n=t(246),i=t(2517),a=t(2039),l={name:"Split",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.split=(m,s,o)=>{f(s);const c=i.ShapeUtil.normalizeAxis(o.axis,s[0].dims.length),v=u(m,s,c,o),y=[];for(let _=0;_d(m,s[0],o,c,_)}),s));return y},e.parseSplitAttributes=m=>{const s=m.attributes.getInt("axis",0),o=m.attributes.getInts("split",[]),c=m.outputs.length;return(0,n.createAttributeWithCacheKey)({axis:s,split:o,numOutputs:c})};const u=(m,s,o,c)=>{const[,v]=i.SplitUtil.splitShape(s[0].dims,o,c.split,c.numOutputs);return v.length},d=(m,s,o,c,v)=>{const[y,_]=i.SplitUtil.splitShape(s.dims,c,o.split,o.numOutputs),b=_[v],x=y[v],w=` - float process(int indices[${x.length}]) { - indices[${c}] += ${b}; - return _A(indices); - } - `;return Object.assign(Object.assign({},l),{cacheHint:`${o.cacheKey}:${v}`,output:{dims:x,type:s.type,textureType:a.TextureType.unpacked},shaderSource:w})},f=m=>{if(!m||m.length!==1)throw new Error("Split requires one input.");if(m[0].type!=="int8"&&m[0].type!=="uint8"&&m[0].type!=="int16"&&m[0].type!=="uint16"&&m[0].type!=="int32"&&m[0].type!=="uint32"&&m[0].type!=="float32"&&m[0].type!=="float64"&&m[0].type!=="bool")throw new Error("Invalid input type.")}},3933:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseSqueezeAttributes=e.squeezeV13=e.squeeze=void 0;const n=t(2517);e.squeeze=(l,u,d)=>{i(u);const f=n.ShapeUtil.squeezeShape(u[0].dims,d);return[l.reshapeUnpacked(u[0],f)]},e.squeezeV13=(l,u)=>(a(u),(0,e.squeeze)(l,[u[0]],Array.from(u[1].integerData))),e.parseSqueezeAttributes=l=>l.attributes.getInts("axes");const i=l=>{if(!l||l.length!==1)throw new Error("Squeeze requires 1 input.");if(l[0].type==="string")throw new Error("invalid input tensor types.")},a=l=>{if(!l||l.length!==2)throw new Error("Squeeze requires 2 inputs.");if(l[1].type!=="int32")throw new Error("Invalid input type.")}},6558:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sum=void 0;const n=t(5060),i=t(2039);e.sum=(u,d)=>{l(d);const f={name:"Sum",inputNames:d.map((m,s)=>`X${s}`),inputTypes:new Array(d.length).fill(i.TextureType.unpacked)};return[u.run(Object.assign(Object.assign({},f),{get:()=>a(u,d,f)}),d)]};const a=(u,d,f)=>{const m=(0,n.getGlsl)(u.session.backend.glContext.version),s=d[0].dims.slice(),o=` - void main() { - vec4 result = ${d.map((c,v)=>`${m.texture2D}(X${v},TexCoords)`).join(" + ")}; - ${m.output} = result; - } - `;return Object.assign(Object.assign({},f),{output:{dims:s,type:d[0].type,textureType:i.TextureType.unpacked},hasMain:!0,shaderSource:o})},l=u=>{if(!u||u.length===0)throw new Error("Sum requires inputs.");const d=u[0].dims.length;for(let f=1;f{Object.defineProperty(e,"__esModule",{value:!0}),e.tile=void 0;const n=t(782),i=t(2039);e.tile=(u,d)=>{l(d);const f={name:"Tile",inputNames:["A"],inputTypes:[i.TextureType.unpacked]};return[u.run(Object.assign(Object.assign({},f),{get:()=>a(u,d,f)}),d)]};const a=(u,d,f)=>{const m=d[0].dims.slice(),s=new Array(m.length),o=[];for(let y=0;y{if(!u||u.length!==2)throw new Error("Tile requires 2 input.");if(u[1].dims.length!==1)throw new Error("The second input shape must 1 dimension.");if(u[1].dims[0]!==u[0].dims.length)throw new Error("Invalid input shape.");if(n.NUMBER_TYPES.indexOf(u[0].type)===-1)throw new Error("Invalid input type.");if(u[1].type!=="int32"&&u[1].type!=="int16")throw new Error("Invalid repeat type.")}},3738:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseTransposeAttributes=e.transpose=void 0;const n=t(246),i=t(2517),a=t(2039),l={name:"Transpose",inputNames:["A"],inputTypes:[a.TextureType.unpacked]};e.transpose=(o,c,v)=>(s(c),[o.run(Object.assign(Object.assign({},l),{cacheHint:v.cacheKey,get:()=>u(o,c[0],v.perm)}),c)]),e.parseTransposeAttributes=o=>(0,n.createAttributeWithCacheKey)({perm:o.attributes.getInts("perm",[])});const u=(o,c,v)=>{const y=c.dims;v=d(y,v);const _=f(y,v),b=y.length,x=` - ${m("perm",v,b)} - float process(int indices[${b}]) { - int a[${b}]; - perm(a, indices); - return _A(a); - }`;return Object.assign(Object.assign({},l),{output:{dims:_,type:c.type,textureType:a.TextureType.unpacked},shaderSource:x})},d=(o,c)=>(c&&c.length!==o.length&&(c=[...o.keys()].reverse()),c),f=(o,c)=>(c=d(o,c),i.ShapeUtil.sortBasedOnPerm(o,c)),m=(o,c,v)=>{const y=[];y.push(`void ${o}(out int a[${v}], int src[${v}]) {`);for(let _=0;_{if(!o||o.length!==1)throw new Error("Transpose requires 1 input.");if(o[0].type!=="float32"&&o[0].type!=="float64")throw new Error("input should be float tensor")}},8710:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.encodeAsUint8=void 0;const n=t(5060),i=t(2039);e.encodeAsUint8=(a,l)=>{const u=l.shape,d=(0,n.getGlsl)(a.session.backend.glContext.version),f=` - const float FLOAT_MAX = 1.70141184e38; - const float FLOAT_MIN = 1.17549435e-38; - - bool isNaN(float val) { - return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true; - } - - highp vec4 encodeAsUint8(highp float v) { - if (isNaN(v)) { - return vec4(255, 255, 255, 255); - } - - highp float av = abs(v); - - if(av < FLOAT_MIN) { - return vec4(0.0, 0.0, 0.0, 0.0); - } else if(v > FLOAT_MAX) { - return vec4(0.0, 0.0, 128.0, 127.0) / 255.0; - } else if(v < -FLOAT_MAX) { - return vec4(0.0, 0.0, 128.0, 255.0) / 255.0; - } - - highp vec4 c = vec4(0,0,0,0); - - highp float e = floor(log2(av)); - highp float m = exp2(fract(log2(av))) - 1.0; - - c[2] = floor(128.0 * m); - m -= c[2] / 128.0; - c[1] = floor(32768.0 * m); - m -= c[1] / 32768.0; - c[0] = floor(8388608.0 * m); - - highp float ebias = e + 127.0; - c[3] = floor(ebias / 2.0); - ebias -= c[3] * 2.0; - c[2] += floor(ebias) * 128.0; - - c[3] += 128.0 * step(0.0, -v); - - return c / 255.0; - } - - void main() { - float value = ${d.texture2D}(X,TexCoords).r; - ${d.output} = encodeAsUint8(value); - }`,m={name:"Uint8Encode",inputTypes:[i.TextureType.unpacked],inputNames:["X"],output:{dims:u,type:l.tensor.type,textureType:i.TextureType.downloadUint8AsFloat},shaderSource:f,hasMain:!0};return a.executeProgram(m,[l.tensor])}},4909:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.tanh=e.tan=e.sqrt=e.sin=e.sigmoid=e.relu=e.not=e.neg=e.log=e.parseLeakyReluAttributes=e.leakyRelu=e.identity=e.floor=e.exp=e.parseEluAttributes=e.elu=e.cos=e.ceil=e.clipV11=e.parseClipAttributes=e.clip=e.atan=e.asin=e.acos=e.abs=e.glslTanh=e.glslTan=e.glslSqrt=e.glslSigmoid=e.glslRelu=e.glslSin=e.glslNot=e.glslNeg=e.glslLog=e.glslLeakyRelu=e.glslIdentity=e.glslClip=e.glslFloor=e.glslExp=e.glslElu=e.glslCos=e.glslCeil=e.glslAtan=e.glslAsin=e.glslAcos=e.glslAbs=void 0;const n=t(246),i=t(2517),a=t(8520),l=t(5060),u=t(2039);function d(){return j("abs")}function f(){return j("acos")}function m(){return j("asin")}function s(){return j("atan")}function o(){return j("ceil")}function c(){return j("cos")}function v(L){const U="elu";return{body:` - const float alpha = float(${L}); - - float ${U}_(float a) { - return a >= 0.0 ? a: (exp(a) - 1.0) * alpha; - } - vec4 ${U}_(vec4 v) { - return vec4(${U}_(v.x), ${U}_(v.y), ${U}_(v.z), ${U}_(v.w)); - } - `,name:U,type:a.FunctionType.ValueBased}}function y(){return j("exp")}function _(){return j("floor")}function b(L,U){const H="clip";return{body:` - const float min = float(${L}); - const float max = float(${U}); - - float ${H}_(float a) { - return clamp(a, min, max); - } - vec4 ${H}_(vec4 v) { - return clamp(v, min, max); - } - `,name:H,type:a.FunctionType.ValueBased}}function x(){const L="indentity";return{body:` - float ${L}_(float a) { - return a; - } - vec4 ${L}_(vec4 v) { - return v; - } - `,name:L,type:a.FunctionType.ValueBased}}function w(L){const U="leakyRelu";return{body:` - const float alpha = float(${L}); - - float ${U}_(float a) { - return a < 0.0 ? a * alpha : a; - } - vec4 ${U}_(vec4 v) { - return vec4(${U}_(v.x), ${U}_(v.y), ${U}_(v.z), ${U}_(v.w)); - } - `,name:U,type:a.FunctionType.ValueBased}}function S(){return j("log")}function T(){const L="neg";return{body:` - float ${L}_(float a) { - return -a; - } - vec4 ${L}_(vec4 v) { - return -v; - } - `,name:L,type:a.FunctionType.ValueBased}}function E(){const L="not";return{body:` - float ${L}_(float a) { - return float( ! bool(a) ); - } - bool ${L}_(bool a) { - return !a; - } - vec4 ${L}_(vec4 v) { - return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w)); - } - bvec4 ${L}_(bvec4 v) { - return bvec4(!v.x, !v.y, !v.z, !v.w); - } - `,name:L,type:a.FunctionType.ValueBased}}function M(){return j("sin")}function P(){const L="relu";return{body:` - float ${L}_(float a) { - return max( a, 0.0 ); - } - vec4 ${L}_(vec4 v) { - return max( v, 0.0 ); - } - `,name:L,type:a.FunctionType.ValueBased}}function A(){const L="sigmoid";return{body:` - float ${L}_(float a) { - return 1.0 / (1.0 + exp(-a)); - } - vec4 ${L}_(vec4 v) { - return 1.0 / (1.0 + exp(-v)); - } - `,name:L,type:a.FunctionType.ValueBased}}function C(){return j("sqrt")}function D(){return j("tan")}function k(){const L="tanh";return{body:` - float ${L}_(float a) { - a = clamp(a, -10., 10.); - a = exp(2.*a); - return (a - 1.) / (a + 1.); - } - vec4 ${L}_(vec4 v) { - v = clamp(v, -10., 10.); - v = exp(2.*v); - return (v - 1.) / (v + 1.); - } - `,name:L,type:a.FunctionType.ValueBased}}function j(L){return{body:` - float ${L}_(float a) { - return ${L}(a); - } - vec4 ${L}_(vec4 v) { - return ${L}(v); - } - `,name:L,type:a.FunctionType.ValueBased}}e.glslAbs=d,e.glslAcos=f,e.glslAsin=m,e.glslAtan=s,e.glslCeil=o,e.glslCos=c,e.glslElu=v,e.glslExp=y,e.glslFloor=_,e.glslClip=b,e.glslIdentity=x,e.glslLeakyRelu=w,e.glslLog=S,e.glslNeg=T,e.glslNot=E,e.glslSin=M,e.glslRelu=P,e.glslSigmoid=A,e.glslSqrt=C,e.glslTan=D,e.glslTanh=k;const I=(L,U,H,Y)=>{const B=L.session.pack?u.TextureType.packed:u.TextureType.unpacked,X={name:H.name,inputTypes:[B],inputNames:["A"],cacheHint:Y};return Object.assign(Object.assign({},X),{get:()=>((Z,z,_e,fe)=>{const We=Z.session.pack?u.TextureType.packed:u.TextureType.unpacked,ft=(0,l.getGlsl)(Z.session.backend.glContext.version);return Object.assign(Object.assign({},z),{output:{dims:_e.dims,type:_e.type,textureType:We},shaderSource:` - ${fe.body} - void main() { - vec4 v = ${ft.texture2D}(A, TexCoords); - v = ${fe.name}_(v); - ${ft.output} = v; - } - `,hasMain:!0})})(L,X,U,H)})};e.abs=(L,U)=>[L.run(I(L,U[0],d()),U)],e.acos=(L,U)=>[L.run(I(L,U[0],f()),U)],e.asin=(L,U)=>[L.run(I(L,U[0],m()),U)],e.atan=(L,U)=>[L.run(I(L,U[0],s()),U)],e.clip=(L,U,H)=>[L.run(I(L,U[0],b(H.min,H.max),H.cacheKey),U)],e.parseClipAttributes=L=>(0,n.createAttributeWithCacheKey)({min:L.attributes.getFloat("min",i.MIN_CLIP),max:L.attributes.getFloat("max",i.MAX_CLIP)}),e.clipV11=(L,U)=>{const H=W(L,U);return(0,e.clip)(L,[U[0]],H)};const W=(L,U)=>{if(U.length>=3&&(!L.session.isInitializer(U[1].dataId)||!L.session.isInitializer(U[2].dataId)))throw new Error("dynamic clip attributes are not allowed");const H=U.length>=3?U[1].numberData[0]:i.MIN_CLIP,Y=U.length>=3?U[2].numberData[0]:i.MAX_CLIP;return(0,n.createAttributeWithCacheKey)({min:H,max:Y})};e.ceil=(L,U)=>[L.run(I(L,U[0],o()),U)],e.cos=(L,U)=>[L.run(I(L,U[0],c()),U)],e.elu=(L,U,H)=>[L.run(I(L,U[0],v(H.alpha),H.cacheKey),U)],e.parseEluAttributes=L=>(0,n.createAttributeWithCacheKey)({alpha:L.attributes.getFloat("alpha",1)}),e.exp=(L,U)=>[L.run(I(L,U[0],y()),U)],e.floor=(L,U)=>[L.run(I(L,U[0],_()),U)],e.identity=(L,U)=>[L.run(I(L,U[0],x()),U)],e.leakyRelu=(L,U,H)=>[L.run(I(L,U[0],w(H.alpha),H.cacheKey),U)],e.parseLeakyReluAttributes=L=>(0,n.createAttributeWithCacheKey)({alpha:L.attributes.getFloat("alpha",.01)}),e.log=(L,U)=>[L.run(I(L,U[0],S()),U)],e.neg=(L,U)=>[L.run(I(L,U[0],T()),U)],e.not=(L,U)=>[L.run(I(L,U[0],E()),U)],e.relu=(L,U)=>[L.run(I(L,U[0],P()),U)],e.sigmoid=(L,U)=>[L.run(I(L,U[0],A()),U)],e.sin=(L,U)=>[L.run(I(L,U[0],M()),U)],e.sqrt=(L,U)=>[L.run(I(L,U[0],C()),U)],e.tan=(L,U)=>[L.run(I(L,U[0],D()),U)],e.tanh=(L,U)=>[L.run(I(L,U[0],k()),U)]},5611:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createUnpackProgramInfoLoader=e.createUnpackProgramInfo=void 0;const n=t(5060),i=t(2039),a=t(9390),l=t(2827),u={name:"unpack",inputNames:["A"],inputTypes:[i.TextureType.packed]};e.createUnpackProgramInfo=(d,f)=>{const m=f.dims.length,s=(0,l.getChannels)("rc",m),o=s.slice(-2),c=(0,a.getCoordsDataType)(m),v=(0,l.unpackFromChannel)(),y=f.dims.length===0?"":function(x,w){if(x===1)return"rc";let S="";for(let T=0;TObject.assign(Object.assign({},u),{get:()=>(0,e.createUnpackProgramInfo)(d,f)})},8428:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseUnsqueezeAttributes=e.unsqueezeV13=e.unsqueeze=void 0;const n=t(2517);e.unsqueeze=(l,u,d)=>{i(u);const f=n.ShapeUtil.unsqueezeShape(u[0].dims,d);return[l.reshapeUnpacked(u[0],f)]},e.unsqueezeV13=(l,u)=>(a(u),(0,e.unsqueeze)(l,[u[0]],Array.from(u[1].integerData))),e.parseUnsqueezeAttributes=l=>l.attributes.getInts("axes");const i=l=>{if(!l||l.length!==1)throw new Error("Unsqueeze requires 1 input.");if(l[0].type==="string")throw new Error("invalid input tensor types.")},a=l=>{if(!l||l.length!==2)throw new Error("Unsqueeze requires 2 inputs.");if(l[1].type!=="int32")throw new Error("Invalid input type.")}},9793:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.scalesValidation=e.validateInputs=e.parseUpsampleAttributes=e.parseUpsampleAttributesV9=e.parseUpsampleAttributesV7=e.upsample=void 0;const n=t(246),i=t(5060),a=t(2039),l={name:"Upsample",inputNames:["X"],inputTypes:[a.TextureType.unpacked]};e.upsample=(d,f,m)=>((0,e.validateInputs)(f,m),[d.run(Object.assign(Object.assign({},l),{cacheHint:m.cacheKey,get:()=>u(d,f,m)}),f)]),e.parseUpsampleAttributesV7=d=>(0,e.parseUpsampleAttributes)(d,7),e.parseUpsampleAttributesV9=d=>(0,e.parseUpsampleAttributes)(d,9),e.parseUpsampleAttributes=(d,f)=>{const m=f>=10,s=d.attributes.getString("mode","nearest");if(s!=="nearest"&&s!=="linear"&&(f<11||s!=="cubic"))throw new Error(`unrecognized mode: ${s}`);let o=[];f<9&&(o=d.attributes.getFloats("scales"),(0,e.scalesValidation)(o,s,m));const c=d.attributes.getFloat("extrapolation_value",0),v=f>10?d.attributes.getString("coordinate_transformation_mode","half_pixel"):"asymmetric";if(["asymmetric","pytorch_half_pixel","tf_half_pixel_for_nn","align_corners","tf_crop_and_resize","half_pixel"].indexOf(v)===-1)throw new Error(`coordinate_transform_mode '${v}' is not supported`);const y=v==="tf_crop_and_resize",_=y,b=s==="nearest"&&f>=11?d.attributes.getString("nearest_mode","round_prefer_floor"):"";if(["round_prefer_floor","round_prefer_ceil","floor","ceil",""].indexOf(b)===-1)throw new Error(`nearest_mode '${b}' is not supported`);const x=d.attributes.getFloat("cubic_coeff_a",-.75),w=d.attributes.getInt("exclude_outside",0)!==0;if(w&&s!=="cubic")throw new Error("exclude_outside can be set to 1 only when mode is CUBIC.");const S=f<11||s==="nearest"&&v==="asymmetric"&&b==="floor";let T=0,E=0,M=0;return f>10?d.inputs.length>2?(T=1,E=2,M=3):(E=1,M=2):f===9&&(E=1),(0,n.createAttributeWithCacheKey)({opset:f,isResize:m,mode:s,scales:o,extrapolationValue:c,coordinateTransformMode:v,useExtrapolation:_,needRoiInput:y,nearestMode:b,cubicCoefficientA:x,excludeOutside:w,useNearest2xOptimization:S,roiInputIdx:T,scalesInputIdx:E,sizesInputIdx:M})};const u=(d,f,m)=>{const s=(0,i.getGlsl)(d.session.backend.glContext.version),[o,c]=d.calculateTextureWidthAndHeight(f[0].dims,a.TextureType.unpacked),v=f[0].dims.map((M,P)=>Math.floor(M*m.scales[P])),[y,_]=d.calculateTextureWidthAndHeight(v,a.TextureType.unpacked),b=v.length,x=new Array(b),w=new Array(b);let S=` - int output_pitches[${b}]; - int input_pitches[${b}]; - `;for(let M=b-1;M>=0;M--)x[M]=M===b-1?1:x[M+1]*v[M+1],w[M]=M===b-1?1:w[M+1]*f[0].dims[M+1],S+=` - output_pitches[${M}] = ${x[M]}; - input_pitches[${M}] = ${w[M]}; - `;const T=` - float getInputFloat(int index) { - vec2 coords = offsetToCoords(index, ${o}, ${c}); - float value = getColorAsFloat(${s.texture2D}(X, coords)); - return value; - } - `,E=m.mode==="nearest"?` - ${T} - float process(int indices[${b}]) { - int input_index = 0; - int output_index = coordsToOffset(TexCoords, ${y}, ${_}); - - ${S} - - int d, m; - for (int dim = 0; dim < ${b}; ++dim) { - d = output_index / output_pitches[dim]; - m = output_index - d * output_pitches[dim]; - output_index = m; - - if (scales[dim] != 1 && d > 0) { - int d2 = d / scales[dim]; - m = d - d2 * scales[dim]; - d = d2; - } - input_index += input_pitches[dim] * d; - } - - return getInputFloat(input_index); - }`:b===4?` - ${T} - float process(int indices[4]) { - int input_index = 0; - int output_index = coordsToOffset(TexCoords, ${y}, ${_}); - - ${S} - - int m; - int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3; - index_of_dim0 = output_index / output_pitches[0]; - m = output_index - index_of_dim0 * output_pitches[0]; - index_of_dim1 = m / output_pitches[1]; - m = m - index_of_dim1 * output_pitches[1]; - index_of_dim2 = m / output_pitches[2]; - m = m - index_of_dim2 * output_pitches[2]; - index_of_dim3 = m; - - int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset; - index_of_input_dim2 = index_of_dim2 / scales[2]; - y_offset = index_of_dim2 - index_of_input_dim2 * scales[2]; - index_of_input_dim3 = index_of_dim3 / scales[3]; - x_offset = index_of_dim3 - index_of_input_dim3 * scales[3]; - - input_index = index_of_dim0 * input_pitches[0] + - index_of_dim1 * input_pitches[1] + - index_of_input_dim2 * input_pitches[2] + - index_of_input_dim3; - - float x00 = getInputFloat(input_index); - float x10, x01, x11; - - bool end_of_dim2 = false; - if (index_of_input_dim2 == (${f[0].dims[2]} - 1)) { - // It's the end in dimension 2 - x01 = x00; - end_of_dim2 = true; - } else { - x01 = getInputFloat(input_index + input_pitches[2]); - } - - if (index_of_input_dim3 == (input_pitches[2] - 1)) { - // It's the end in dimension 3 - x10 = x00; - x11 = x01; - } - else { - x10 = getInputFloat(input_index + 1); - x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1); - } - - float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]); - float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]); - return y0 + float(x_offset) * (y1 - y0) / float(scales[3]); - }`:` - ${T} - float process(int indices[2]) { - int input_index = 0; - int output_index = coordsToOffset(TexCoords, ${y}, ${_}); - - ${S} - - int m; - int index_of_dim0, index_of_dim1; - index_of_dim0 = output_index / output_pitches[0]; - m = output_index - index_of_dim0 * output_pitches[0]; - index_of_dim1 = m; - - int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset; - index_of_input_dim0 = index_of_dim0 / scales[0]; - y_offset = index_of_dim0 - index_of_input_dim0 * scales[0]; - index_of_input_dim1 = index_of_dim1 / scales[1]; - x_offset = index_of_dim1 - index_of_input_dim1 * scales[1]; - - input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1; - - float x00 = getInputFloat(input_index); - float x10, x01, x11; - - bool end_of_dim0 = false; - if (index_of_input_dim0 == (${f[0].dims[0]} - 1)) { - // It's the end in dimension 0 - x01 = x00; - end_of_dim0 = true; - } else { - x01 = getInputFloat(input_index + input_pitches[0]); - } - - if (index_of_input_dim1 == (input_pitches[0] - 1)) { - // It's the end in dimension 1 - x10 = x00; - x11 = x01; - } - else { - x10 = getInputFloat(input_index + 1); - x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1); - } - - float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]); - float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]); - return y0 + float(x_offset) * (y1 - y0) / float(scales[1]); - }`;return Object.assign(Object.assign({},l),{output:{dims:v,type:f[0].type,textureType:a.TextureType.unpacked},shaderSource:E,variables:[{name:"scales",type:"int",arrayLength:m.scales.length,data:m.scales.map(M=>Math.ceil(M))}]})};e.validateInputs=(d,f)=>{if(!d||f.opset<9&&d.length!==1||f.opset>=9&&f.opset<11&&d.length!==2||f.opset>=11&&d.length<2)throw new Error("invalid inputs.");if(f.scales.length>0&&d[0].dims.length!==f.scales.length)throw new Error("Invalid input shape.");if(d[0].type==="string")throw new Error("Invalid input tensor types.")},e.scalesValidation=(d,f,m)=>{if(m){for(const s of d)if(s<=0)throw new Error("Scale value should be greater than 0.")}else for(const s of d)if(s<1)throw new Error("Scale value should be greater than or equal to 1.");if(!(f!=="linear"&&f!=="cubic"||d.length===2||d.length===4&&d[0]===1&&d[1]===1))throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') or 4-D inputs with the corresponding outermost 2 scale values being 1 in the ${m?"Resize":"Upsample"} opeartor.`)}},1958:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProgramManager=void 0;const n=t(1670),i=t(6231),a=t(8879),l=t(5060);e.ProgramManager=class{constructor(u,d,f){this.profiler=u,this.glContext=d,this.textureLayoutStrategy=f,this.repo=new Map,this.attributesBound=!1}getArtifact(u){return this.repo.get(u)}setArtifact(u,d){this.repo.set(u,d)}run(u,d,f){var m;this.profiler.event("op",`ProgramManager.run ${(m=u.programInfo.name)!==null&&m!==void 0?m:"unknown kernel"}`,()=>{var s;const o=this.glContext.gl,c=u.program;o.useProgram(c);try{this.bindOutput(f),this.attributesBound||this.bindAttributes(u.attribLocations),this.bindUniforms(u.uniformLocations,(s=u.programInfo.variables)!==null&&s!==void 0?s:[],d)}catch(v){throw i.Logger.error("ProgramManager",u.programInfo.shaderSource),v}this.profiler.event("backend","GlContext.draw()",()=>{this.glContext.draw()})},this.glContext)}dispose(){this.vertexShader&&this.glContext.deleteShader(this.vertexShader),this.repo.forEach(u=>this.glContext.deleteProgram(u.program))}build(u,d,f){return this.profiler.event("backend","ProgramManager.build",()=>{const m=new a.GlslPreprocessor(this.glContext,u,d,f),s=m.preprocess(),o=this.compile(s);return{programInfo:u,program:o,uniformLocations:this.getUniformLocations(o,m.context.programInfo.inputNames,m.context.programInfo.variables),attribLocations:this.getAttribLocations(o)}})}compile(u){if(!this.vertexShader){i.Logger.verbose("ProrgramManager","Compiling and caching Vertex shader for the first time");const m=(0,l.getVertexShaderSource)(this.glContext.version);this.vertexShader=this.glContext.compileShader(m,this.glContext.gl.VERTEX_SHADER)}n.env.debug&&i.Logger.verbose("ProrgramManager",`FragShader: -${u} -`);const d=this.glContext.compileShader(u,this.glContext.gl.FRAGMENT_SHADER),f=this.glContext.createProgram(this.vertexShader,d);return this.glContext.deleteShader(d),f}bindOutput(u){const d=u.width,f=u.height;i.Logger.verbose("ProrgramManager",`Binding output texture to Framebuffer: w/h=${d}/${f}, shape=${u.shape}, type=${u.tensor.type}`),this.glContext.attachFramebuffer(u.texture,d,f)}bindAttributes(u){const d=u.position,f=u.textureCoord;this.glContext.setVertexAttributes(d,f),this.attributesBound=!0}bindUniforms(u,d,f){var m;const s=this.glContext.gl;let o=0;for(const{name:c,type:v,location:y,arrayLength:_}of u){const b=(m=d.find(x=>x.name===c))===null||m===void 0?void 0:m.data;if(v!=="sampler2D"&&!b)throw new Error(`variable '${c}' does not have data defined in program info`);switch(v){case"sampler2D":this.bindTexture(f[o],y,o),o++;break;case"float":_?s.uniform1fv(y,b):s.uniform1f(y,b);break;case"int":_?s.uniform1iv(y,b):s.uniform1i(y,b);break;default:throw new Error(`Uniform not implemented: ${v}`)}}}bindTexture(u,d,f){this.glContext.bindTextureToUniform(u.texture,f,d)}getAttribLocations(u){return{position:this.getAttribLocation(u,"position"),textureCoord:this.getAttribLocation(u,"textureCoord")}}getUniformLocations(u,d,f){const m=[];if(d)for(const s of d)m.push({name:s,type:"sampler2D",location:this.getUniformLocation(u,s)});if(f)for(const s of f)m.push(Object.assign(Object.assign({},s),{location:this.getUniformLocation(u,s.name)}));return m}getUniformLocation(u,d){const f=this.glContext.gl.getUniformLocation(u,d);if(f===null)throw new Error(`Uniform ${d} not found.`);return f}getAttribLocation(u,d){return this.glContext.gl.getAttribLocation(u,d)}}},6416:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLSessionHandler=void 0;const n=t(6231),i=t(1047),a=t(8316),l=t(1640),u=t(1958),d=t(7859),f=t(5702);e.WebGLSessionHandler=class{constructor(m,s){this.backend=m,this.context=s,this.layoutStrategy=new d.PreferLogicalStrategy(m.glContext.maxTextureSize),this.programManager=new u.ProgramManager(this.context.profiler,m.glContext,this.layoutStrategy),this.textureManager=new f.TextureManager(m.glContext,this.layoutStrategy,this.context.profiler,{reuseTextures:m.textureCacheMode==="full"}),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache=new Map,this.pack=m.pack,this.pack2unpackMap=new Map,this.unpack2packMap=new Map}createInferenceHandler(){return new a.WebGLInferenceHandler(this)}onGraphInitialized(m){const s=m.getValues().filter(o=>o.from===-1&&o.tensor).map(o=>o.tensor.dataId);this.initializers=new Set(s)}isInitializer(m){return!!this.initializers&&this.initializers.has(m)}addInitializer(m){this.initializers.add(m)}getTextureData(m,s){return s?this.packedTextureDataCache.get(m):this.unpackedTextureDataCache.get(m)}setTextureData(m,s,o=!1){n.Logger.verbose("WebGLSessionHandler","Storing Texture data in cache"),o?this.packedTextureDataCache.set(m,s):this.unpackedTextureDataCache.set(m,s)}dispose(){this.programManager.dispose(),this.textureManager.clearActiveTextures(),this.packedTextureDataCache.forEach(m=>this.textureManager.releaseTexture(m,!0)),this.packedTextureDataCache=new Map,this.unpackedTextureDataCache.forEach(m=>this.textureManager.releaseTexture(m,!0)),this.unpackedTextureDataCache=new Map}resolve(m,s,o){const c=(0,i.resolveOperator)(m,s,l.WEBGL_OP_RESOLVE_RULES);return{impl:c.opImpl,context:c.opInit?c.opInit(m,o):m}}}},7769:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Uint8DataEncoder=e.RGBAFloatDataEncoder=e.RedFloat32DataEncoder=void 0;const n=t(6231);e.RedFloat32DataEncoder=class{constructor(i,a=1){if(a===1)this.internalFormat=i.R32F,this.format=i.RED,this.textureType=i.FLOAT,this.channelSize=a;else{if(a!==4)throw new Error(`Invalid number of channels: ${a}`);this.internalFormat=i.RGBA32F,this.format=i.RGBA,this.textureType=i.FLOAT,this.channelSize=a}}encode(i,a){let l,u;return i.constructor!==Float32Array&&(n.Logger.warning("Encoder","data was not of type Float32; creating new Float32Array"),u=new Float32Array(i)),a*this.channelSize>i.length?(n.Logger.warning("Encoder","Source data too small. Allocating larger array"),u=i,l=this.allocate(a*this.channelSize),u.forEach((d,f)=>l[f]=d)):(u=i,l=u),l}allocate(i){return new Float32Array(4*i)}decode(i,a){return this.channelSize===1?i.filter((l,u)=>u%4==0).subarray(0,a):i.subarray(0,a)}},e.RGBAFloatDataEncoder=class{constructor(i,a=1,l){if(a!==1&&a!==4)throw new Error(`Invalid number of channels: ${a}`);this.internalFormat=i.RGBA,this.format=i.RGBA,this.channelSize=a,this.textureType=l||i.FLOAT}encode(i,a){let l=i;return this.channelSize===1&&(n.Logger.verbose("Encoder","Exploding into a larger array"),l=this.allocate(a),i.forEach((u,d)=>l[4*d]=u)),l}allocate(i){return new Float32Array(4*i)}decode(i,a){return this.channelSize===1?i.filter((l,u)=>u%4==0).subarray(0,a):i.subarray(0,a)}},e.Uint8DataEncoder=class{constructor(i,a=1){if(this.channelSize=4,a===1)this.internalFormat=i.ALPHA,this.format=i.ALPHA,this.textureType=i.UNSIGNED_BYTE,this.channelSize=a;else{if(a!==4)throw new Error(`Invalid number of channels: ${a}`);this.internalFormat=i.RGBA,this.format=i.RGBA,this.textureType=i.UNSIGNED_BYTE,this.channelSize=a}}encode(i,a){return new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}allocate(i){return new Uint8Array(i*this.channelSize)}decode(i,a){if(i instanceof Uint8Array)return i.subarray(0,a);throw new Error(`Invalid array type: ${i.constructor}`)}}},7859:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getBatchDim=e.sizeToSquarishShape=e.getRowsCols=e.sizeFromShape=e.isInt=e.parseAxisParam=e.squeezeShape=e.PreferLogicalStrategy=e.AlwaysKeepOriginalSizeStrategy=void 0;const n=t(6231),i=t(2517);function a(m,s){const o=[],c=[],v=s!=null&&Array.isArray(s)&&s.length===0,y=s==null||v?null:l(s,m).sort();let _=0;for(let b=0;bb)&&m[b]===1&&(o.push(m[b]),c.push(b)),y[_]<=b&&_++}m[b]!==1&&(o.push(m[b]),c.push(b))}return{newShape:o,keptDims:c}}function l(m,s){const o=s.length;return m=m==null?s.map((c,v)=>v):[].concat(m),(0,i.assert)(m.every(c=>c>=-o&&c`All values in axis param must be in range [-${o}, ${o}) but got axis ${m}`),(0,i.assert)(m.every(u),()=>`All values in axis param must be integers but got axis ${m}`),m.map(c=>c<0?o+c:c)}function u(m){return m%1==0}function d(m){if(m.length===0)return 1;let s=m[0];for(let o=1;o=m.length?1:m.slice(s.breakAxis).reduce((b,x)=>b*x),_=s.breakAxis<=0?1:m.slice(0,s.breakAxis).reduce((b,x)=>b*x);if(!(y>o||_>o))return[y,_];n.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${m}, breakAxis:${s.breakAxis}`)}const c=m.reduce((y,_)=>y*_);let v=Math.floor(Math.sqrt(c));for(;v=o||c%v!=0)throw new Error(`The given dimensions are outside this GPU's boundaries: ${m}`);return[v,c/v]}},e.PreferLogicalStrategy=class{constructor(m){this.maxTextureSize=m}computeTextureWH(m,s){const o=this.computeTexture(m,s);return s&&s.isPacked&&(o[0]/=2,o[1]/=2),s&&s.reverseWH?[o[1],o[0]]:o}computeTexture(m,s){const o=s&&s.isPacked;if(m.length===0)return o?[2,2]:[1,1];let c=this.maxTextureSize;if(s&&s.breakAxis!==void 0){const _=s.breakAxis>=m.length?1:m.slice(s.breakAxis).reduce((x,w)=>x*w),b=s.breakAxis<=0?1:m.slice(0,s.breakAxis).reduce((x,w)=>x*w);if(!(_>c||b>c))return[_,b];n.Logger.verbose("TextureLayout",`Given width/height preferences were unattainable: shape:${m}, breakAxis:${s.breakAxis}`)}let v=m.slice(0);o&&(c*=2,v=v.map((_,b)=>b>=v.length-2?v[b]%2==0?v[b]:v[b]+1:v[b]),v.length===1&&(v=[2,v[0]])),v.length!==2&&(v=a(v).newShape);const y=d(v);return v.length<=1&&y<=c?[1,y]:v.length===2&&v[0]<=c&&v[1]<=c?v:v.length===3&&v[0]*v[1]<=c&&v[2]<=c?[v[0]*v[1],v[2]]:v.length===3&&v[0]<=c&&v[1]*v[2]<=c?[v[0],v[1]*v[2]]:v.length===4&&v[0]*v[1]*v[2]<=c&&v[3]<=c?[v[0]*v[1]*v[2],v[3]]:v.length===4&&v[0]<=c&&v[1]*v[2]*v[3]<=c?[v[0],v[1]*v[2]*v[3]]:o?f(y/4).map(_=>2*_):f(y)}},e.squeezeShape=a,e.parseAxisParam=l,e.isInt=u,e.sizeFromShape=d,e.getRowsCols=function(m){if(m.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[m.length>1?m[m.length-2]:1,m[m.length-1]]},e.sizeToSquarishShape=f,e.getBatchDim=function(m,s=2){return d(m.slice(0,m.length-s))}},4057:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createTextureLayoutFromShape=e.calculateTextureWidthAndHeight=e.createTextureLayoutFromTextureType=void 0;const n=t(2517),i=t(2039);e.createTextureLayoutFromTextureType=(a,l,u)=>{const d=u===i.TextureType.unpacked||u===i.TextureType.unpackedReversed?1:4,f=u===i.TextureType.packed,m=u===i.TextureType.unpackedReversed||u===i.TextureType.packed,s=u===i.TextureType.packedLastDimension?l.length-1:void 0,o=u===i.TextureType.packedLastDimension?l.map((c,v)=>v===l.length-1?4*c:c):void 0;return(0,e.createTextureLayoutFromShape)(a,l,d,o,{isPacked:f,reverseWH:m,breakAxis:s})},e.calculateTextureWidthAndHeight=(a,l,u)=>{const d=(0,e.createTextureLayoutFromTextureType)(a,l,u);return[d.width,d.height]},e.createTextureLayoutFromShape=(a,l,u=1,d,f)=>{const m=!(!f||!f.isPacked),[s,o]=a.computeTextureWH(m&&d||l,f),c=l.length;let v=l.slice(0);if(c===0&&(v=[1]),u===1)d=l;else if(m){if(u!==4)throw new Error("a packed texture must be 4-channel");d=l,c>0&&(v[c-1]=Math.ceil(v[c-1]/2)),c>1&&(v[c-2]=Math.ceil(v[c-2]/2))}else if(!d)throw new Error("Unpacked shape is needed when using channels > 1");return{width:s,height:o,channels:u,isPacked:m,shape:v,strides:n.ShapeUtil.computeStrides(v),unpackedShape:d,reversedWH:f&&f.reverseWH}}},5702:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextureManager=void 0;const n=t(6231);e.TextureManager=class{constructor(i,a,l,u){this.glContext=i,this.layoutStrategy=a,this.profiler=l,this.config=u,this.pendingRead=new Map,u.reuseTextures&&(this.inUseTextures=new Map,this.idleTextures=new Map,this.textureLookup=new Map)}createTextureFromLayout(i,a,l,u){const d=this.toEncoderType(i),f=this.glContext.getEncoder(d,a.channels||1,u);if(a.isPacked&&u===1)throw new Error("not implemented");const m=a.width,s=a.height;let o,c;if(this.config.reuseTextures){o=`${m}x${s}_${f.format}_${f.internalFormat}_${f.textureType}`,c=this.inUseTextures.get(o),c||(c=[],this.inUseTextures.set(o,c));const y=this.idleTextures.get(o);if(y&&y.length>0){const _=y.pop();return c.push(_),u===1&&this.glContext.updateTexture(_,m,s,f,this.toTextureData(i,l)),_}}n.Logger.verbose("TextureManager",`Creating new texture of size ${a.width}x${a.height}`);const v=this.glContext.allocateTexture(m,s,f,this.toTextureData(i,l));return this.config.reuseTextures&&(c.push(v),this.textureLookup.set(v,o)),v}readTexture(i,a,l){return l||(l=1),this.profiler.event("backend","TextureManager.readTexture",()=>{const u=i.shape.reduce((f,m)=>f*m)*l,d=this.glContext.readTexture(i.texture,i.width,i.height,u,this.toEncoderType(a),l);return this.toTensorData(a,d)})}async readTextureAsync(i,a,l){const u=i.tensor.dataId;if(l||(l=1),this.pendingRead.has(u)){const d=this.pendingRead.get(u);return new Promise(f=>d==null?void 0:d.push(f))}return this.profiler.event("backend","TextureManager.readTextureAsync",async()=>{this.pendingRead.set(u,[]);const d=i.shape.reduce((o,c)=>o*c)*l;await this.glContext.createAndWaitForFence();const f=this.glContext.readTexture(i.texture,i.width,i.height,d,this.toEncoderType(a),l),m=this.toTensorData(a,f),s=this.pendingRead.get(u);return this.pendingRead.delete(u),s==null||s.forEach(o=>o(m)),m})}readUint8TextureAsFloat(i){return this.profiler.event("backend","TextureManager.readUint8TextureAsFloat",()=>{const a=i.shape.reduce((u,d)=>u*d),l=this.glContext.readTexture(i.texture,i.width,i.height,4*a,"byte",4);return new Float32Array(l.buffer,l.byteOffset,a)})}releaseTexture(i,a){let l;if(this.config.reuseTextures&&(l=this.textureLookup.get(i.texture),l)){a&&this.textureLookup.delete(l);const u=this.inUseTextures.get(l);if(u){const d=u.indexOf(i.texture);if(d!==-1){u.splice(d,1);let f=this.idleTextures.get(l);f||(f=[],this.idleTextures.set(l,f)),f.push(i.texture)}}}l&&!a||(n.Logger.verbose("TextureManager",`Deleting texture of size ${i.width}x${i.height}`),this.glContext.deleteTexture(i.texture))}toTensorData(i,a){switch(i){case"int16":return a instanceof Int16Array?a:Int16Array.from(a);case"int32":return a instanceof Int32Array?a:Int32Array.from(a);case"int8":return a instanceof Int8Array?a:Int8Array.from(a);case"uint16":return a instanceof Uint16Array?a:Uint16Array.from(a);case"uint32":return a instanceof Uint32Array?a:Uint32Array.from(a);case"uint8":case"bool":return a instanceof Uint8Array?a:Uint8Array.from(a);case"float32":return a instanceof Float32Array?a:Float32Array.from(a);case"float64":return a instanceof Float64Array?a:Float64Array.from(a);default:throw new Error(`TensorData type ${i} is not supported`)}}toTextureData(i,a){if(a)return a instanceof Float32Array?a:new Float32Array(a)}toEncoderType(i){return"float"}clearActiveTextures(){this.glContext.clearActiveTextures()}}},2039:(r,e)=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TextureType=void 0,(t=e.TextureType||(e.TextureType={}))[t.unpacked=0]="unpacked",t[t.unpackedReversed=1]="unpackedReversed",t[t.packed=2]="packed",t[t.downloadUint8AsFloat=3]="downloadUint8AsFloat",t[t.packedLastDimension=4]="packedLastDimension"},9390:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getGlChannels=e.getCoordsDataType=e.getSqueezedParams=e.squeezeInputShape=e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=e.generateShaderFuncNameFromInputSamplerName=e.repeatedTry=e.getPackedShape=void 0;const n=t(2517);e.getPackedShape=function(i){const a=i.length;return i.slice(0,a-1).concat(i[a-1]/4)},e.repeatedTry=async function(i,a=u=>0,l){return new Promise((u,d)=>{let f=0;const m=()=>{if(i())return void u();f++;const s=a(f);l!=null&&f>=l?d():setTimeout(m,s)};m()})},e.generateShaderFuncNameFromInputSamplerName=function(i){return(0,n.assert)(i!==void 0&&i.length!==0,()=>"empty string found for sampler name"),"get"+i.charAt(0).toUpperCase()+i.slice(1)},e.generateShaderFuncNameFromInputSamplerNameAtOutCoords=function(i){return(0,n.assert)(i!==void 0&&i.length!==0,()=>"empty string found for sampler name"),"get"+i.charAt(0).toUpperCase()+i.slice(1)+"AtOutCoords"},e.squeezeInputShape=function(i,a){let l=JSON.parse(JSON.stringify(i));return l=a,l},e.getSqueezedParams=function(i,a){return a.map(l=>i[l]).join(", ")},e.getCoordsDataType=function(i){if(i<=1)return"int";if(i===2)return"ivec2";if(i===3)return"ivec3";if(i===4)return"ivec4";if(i===5)return"ivec5";if(i===6)return"ivec6";throw Error(`GPU for rank ${i} is not yet supported`)},e.getGlChannels=function(i=6){return["x","y","z","w","u","v"].slice(0,i)}},7305:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createNewWebGLContext=e.createWebGLContext=void 0;const n=t(6231),i=t(1713),a={};function l(u){const d=function(){if(typeof document>"u"){if(typeof OffscreenCanvas>"u")throw new TypeError("failed to create canvas: OffscreenCanvas is not supported");return new OffscreenCanvas(1,1)}const s=document.createElement("canvas");return s.width=1,s.height=1,s}();let f;const m={alpha:!1,depth:!1,antialias:!1,stencil:!1,preserveDrawingBuffer:!1,premultipliedAlpha:!1,failIfMajorPerformanceCaveat:!1};if((!u||u==="webgl2")&&(f=d.getContext("webgl2",m),f))try{return new i.WebGLContext(f,2)}catch(s){n.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl2'. Error: ${s}`)}if((!u||u==="webgl")&&(f=d.getContext("webgl",m)||d.getContext("experimental-webgl",m),f))try{return new i.WebGLContext(f,1)}catch(s){n.Logger.warning("GlContextFactory",`failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${s}`)}throw new Error("WebGL is not supported")}e.createWebGLContext=function u(d){let f;d&&d!=="webgl2"||!("webgl2"in a)?d&&d!=="webgl"||!("webgl"in a)||(f=a.webgl):f=a.webgl2,f=f||l(d),d=d||f.version===1?"webgl":"webgl2";const m=f.gl;return a[d]=f,m.isContextLost()?(delete a[d],u(d)):(m.disable(m.DEPTH_TEST),m.disable(m.STENCIL_TEST),m.disable(m.BLEND),m.disable(m.DITHER),m.disable(m.POLYGON_OFFSET_FILL),m.disable(m.SAMPLE_COVERAGE),m.enable(m.SCISSOR_TEST),m.enable(m.CULL_FACE),m.cullFace(m.BACK),f)},e.createNewWebGLContext=l},1713:function(r,e,t){var n=this&&this.__createBinding||(Object.create?function(m,s,o,c){c===void 0&&(c=o);var v=Object.getOwnPropertyDescriptor(s,o);v&&!("get"in v?!s.__esModule:v.writable||v.configurable)||(v={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(m,c,v)}:function(m,s,o,c){c===void 0&&(c=o),m[c]=s[o]}),i=this&&this.__setModuleDefault||(Object.create?function(m,s){Object.defineProperty(m,"default",{enumerable:!0,value:s})}:function(m,s){m.default=s}),a=this&&this.__importStar||function(m){if(m&&m.__esModule)return m;var s={};if(m!=null)for(var o in m)o!=="default"&&Object.prototype.hasOwnProperty.call(m,o)&&n(s,m,o);return i(s,m),s};Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLContext=e.linearSearchLastTrue=void 0;const l=t(1670),u=a(t(7769)),d=t(9390);function f(m){let s=0;for(;sthis.isTimerResultAvailable(m)),this.getTimerResult(m)}async createAndWaitForFence(){const m=this.createFence(this.gl);return this.pollFence(m)}createFence(m){let s;const o=m,c=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);return m.flush(),s=c===null?()=>!0:()=>{const v=o.clientWaitSync(c,0,0);return v===o.ALREADY_SIGNALED||v===o.CONDITION_SATISFIED},{query:c,isFencePassed:s}}async pollFence(m){return new Promise(s=>{this.addItemToPoll(()=>m.isFencePassed(),()=>s())})}pollItems(){const m=f(this.itemsToPoll.map(s=>s.isDoneFn));for(let s=0;s<=m;++s){const{resolveFn:o}=this.itemsToPoll[s];o()}this.itemsToPoll=this.itemsToPoll.slice(m+1)}async addItemToPoll(m,s){this.itemsToPoll.push({isDoneFn:m,resolveFn:s}),this.itemsToPoll.length>1||await(0,d.repeatedTry)(()=>(this.pollItems(),this.itemsToPoll.length===0))}}},1036:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExecutionPlan=void 0;const n=t(6231);class i{constructor(l,u){this.op=l,this.node=u}}e.ExecutionPlan=class{constructor(a,l,u){this.graph=a,this.profiler=u,this.initialize(l)}initialize(a){this.profiler.event("session","ExecutionPlan.initialize",()=>{const l=this.graph.getNodes();if(l.length!==a.length)throw new Error("The size of nodes and OPs do not match.");this._ops=a.map((u,d)=>new i(u,l[d])),this.reset(),this._starter=[],this._ops.forEach((u,d)=>{let f=!0;for(const m of u.node.inputs)if(!this._values[m]&&this.graph.getInputIndices().indexOf(m)===-1){f=!1;break}f&&this._starter.push(d)})})}reset(){this._values=this.graph.getValues().map(a=>a.tensor)}async execute(a,l){return this.profiler.event("session","ExecutionPlan.execute",async()=>{this.reset();const u=a.createInferenceHandler(),d=this.graph.getInputIndices();if(l.length!==d.length)throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${l.length} expected: ${d.length}`);l.forEach((v,y)=>{const _=d[y];this._values[_]=v});const f=this._starter.slice(0),m=this.graph.getValues(),s=this.graph.getNodes();let o=0;for(;othis._values[S]);if(_.indexOf(void 0)!==-1)throw new Error(`unresolved input detected: op: ${y.node}`);const b=_;n.Logger.verbose("ExecPlan",`Runing op:${y.node.name} (${b.map((S,T)=>`'${y.node.inputs[T]}': ${S.type}[${S.dims.join(",")}]`).join(", ")})`);const x=await this.profiler.event("node",y.node.name,async()=>y.op.impl(u,b,y.op.context));if(x.length!==y.node.outputs.length)throw new Error("the size of output does not match model definition.");x.forEach((S,T)=>{const E=y.node.outputs[T];if(this._values[E])throw new Error(`output [${E}] already has value: op:${y.node.name}`);this._values[E]=S});const w=new Set;x.forEach((S,T)=>{const E=y.node.outputs[T];for(const M of m[E].to){const P=s[M];let A=!0;for(const C of P.inputs)if(!this._values[C]){A=!1;break}A&&w.add(M)}}),f.push(...w)}const c=[];for(let v=0;v{Object.defineProperty(e,"__esModule",{value:!0}),e.Graph=void 0;const n=t(1446),i=t(7778),a=t(9395),l=t(9162),u=t(2517);var d=a.onnxruntime.experimental.fbs;e.Graph={from:(o,c)=>new s(o,c)};class f{constructor(c){this._from=void 0,this._to=[],this.tensor=void 0,this.type=void 0,c&&(this.type=u.ProtoUtil.tensorValueTypeFromProto(c.type.tensorType))}get from(){return this._from}get to(){return this._to}}class m{constructor(c,v){c instanceof n.onnx.NodeProto?(this.name=c.name,this.opType=c.opType,this.attributes=new i.Attribute(c.attribute)):c instanceof d.Node&&(this.name=v??c.name(),this.opType=c.opType(),this.attributes=new i.Attribute(u.ProtoUtil.tensorAttributesFromORTFormat(c))),this.inputs=[],this.outputs=[],this.executeNode=!0}}class s{constructor(c,v){if(!c)throw new TypeError("graph is empty");this.buildGraph(c),this.transformGraph(v),this.checkIsAcyclic()}getInputIndices(){return this._allInputIndices}getInputNames(){return this._allInputNames}getOutputIndices(){return this._allOutputIndices}getOutputNames(){return this._allOutputNames}getValues(){return this._allData}getNodes(){return this._nodes}buildGraph(c){if(c instanceof n.onnx.GraphProto)this.buildGraphFromOnnxFormat(c);else{if(!(c instanceof d.Graph))throw new TypeError("Graph type is not supported.");this.buildGraphFromOrtFormat(c)}}buildGraphFromOnnxFormat(c){const v=new Map;this._allData=[],this._allInputIndices=[],this._allInputNames=[],this._allOutputIndices=[],this._allOutputNames=[],this._nodes=[];const y=new Map;if(!c.input)throw new Error("missing information in graph: input");const _=[];for(const b of c.input){if(v.has(b.name))throw new Error(`duplicated input name: ${b.name}`);const x=this._allData.push(new f(b))-1;v.set(b.name,x),_.push(b.name)}if(!c.initializer)throw new Error("missing information in graph: initializer");for(const b of c.initializer){let x=v.get(b.name);if(x===void 0){const w=new f;w.type={shape:{dims:u.ProtoUtil.tensorDimsFromProto(b.dims)},tensorType:u.ProtoUtil.tensorDataTypeFromProto(b.dataType)},x=this._allData.push(w)-1,v.set(b.name,x)}this._allData[x]._from=-1,this._allData[x].tensor=l.Tensor.fromProto(b)}for(let b=0;b{this._allData[_]._to.forEach(b=>{c.add(b)})});const v=Array.from(c),y=new Array(this._nodes.length).fill("white");for(;v.length>0;){const _=v.pop();y[_]==="gray"?y[_]="black":(v.push(_),y[_]="gray",this._nodes[_].outputs.forEach(b=>{const x=this._allData[b];if(x.tensor!==void 0)throw new Error("node outputs should not be initialized");if(x._from!==_)throw new Error("from property of the Value object doesn't match index of Node being processed");x._to.forEach(w=>{if(y[w]==="gray")throw new Error("model graph is cyclic");y[w]==="white"&&v.push(w)})}))}}transformGraph(c){this.removeAllIdentityNodes(),this.removeAllDropoutNodes(),this.fuseConvActivationNodes(),c&&c.transformGraph(this),this.finalizeGraph()}finalizeGraph(){let c=0;for(let v=0;v0&&(this._nodes[v].inputs.forEach(y=>{const _=this._allData[y]._to.indexOf(v+c);_!==-1&&(this._allData[y]._to[_]=v)}),this._nodes[v].outputs.forEach(y=>{this._allData[y]._from&&this._allData[y]._from===v+c&&(this._allData[y]._from=v)})):(c++,this._nodes[v].outputs.forEach(y=>{this._allData[y]._from=-2}),this._nodes.splice(v,1),v--);c=0;for(let v=0;v0){let y=-1;this._allData[v].from!==void 0&&this._allData[v].from!==-1?(y=this._nodes[this._allData[v].from].outputs.indexOf(v+c),y!==-1&&(this._nodes[this._allData[v].from].outputs[y]=v)):(y=this._allInputIndices.indexOf(v+c),y!==-1&&(this._allInputIndices[y]=v)),this._allData[v].to.forEach(_=>{y=this._nodes[_].inputs.indexOf(v+c),y!==-1&&(this._nodes[_].inputs[y]=v)}),this._allData[v].to.length===0&&(y=this._allOutputIndices.indexOf(v+c),y!==-1&&(this._allOutputIndices[y]=v))}}else c++,this._allData.splice(v,1),v--}deleteNode(c){const v=this._nodes[c];if(v.outputs.length>1){for(let S=1;S0)throw new Error("Node deletion with more than one output connected to other nodes is not supported. ")}v.executeNode=!1;const y=v.inputs[0],_=v.outputs[0],b=this._allData[_].to,x=this._allData[y].to.indexOf(c);if(x===-1)throw new Error("The Value object doesn't have the current Node in it's 'to' property ");this._allData[y].to.splice(x,1),this._allData[_]._to=[];const w=this._allOutputIndices.indexOf(_);if(w!==-1&&(this._allOutputIndices[w]=y),b&&b.length>0)for(const S of b){const T=this._nodes[S].inputs.indexOf(_);if(T===-1)throw new Error("The Node object doesn't have the output Value in it's 'inputs' property ");this._nodes[S].inputs[T]=y,this._allData[y].to.push(S)}}removeAllDropoutNodes(){let c=0;for(const v of this._nodes){if(v.opType==="Dropout"){if(v.inputs.length!==1)throw new Error("Dropout nodes should only contain one input. ");if(v.outputs.length!==1&&v.outputs.length!==2)throw new Error("Dropout nodes should contain either 1 or 2 output(s)");if(v.outputs.length===2&&this._allData[v.outputs[1]]._to.length!==0)throw new Error("Dropout nodes's second output should not be referenced by other nodes");this.deleteNode(c)}c++}}removeAllIdentityNodes(){let c=0;for(const v of this._nodes)v.opType==="Identity"&&this.deleteNode(c),c++}isActivation(c){switch(c.opType){case"Relu":case"Sigmoid":case"Clip":return!0;default:return!1}}fuseConvActivationNodes(){for(const c of this._nodes)if(c.opType==="Conv"){const v=this._allData[c.outputs[0]]._to;if(v.length===1&&this.isActivation(this._nodes[v[0]])){const y=this._nodes[v[0]];if(y.opType==="Clip")if(y.inputs.length===1)try{c.attributes.set("activation_params","floats",[y.attributes.getFloat("min"),y.attributes.getFloat("max")])}catch{c.attributes.set("activation_params","floats",[u.MIN_CLIP,u.MAX_CLIP])}else{if(!(y.inputs.length>=3&&this._allData[y.inputs[1]].tensor!==void 0&&this._allData[y.inputs[2]].tensor!==void 0))continue;c.attributes.set("activation_params","floats",[this._allData[y.inputs[1]].tensor.floatData[0],this._allData[y.inputs[2]].tensor.floatData[0]])}c.attributes.set("activation","string",y.opType),this.deleteNode(v[0])}}}}},6231:(r,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.now=e.Profiler=e.Logger=void 0;const t={verbose:1e3,info:2e3,warning:4e3,error:5e3,fatal:6e3},n={none:new class{log(m,s,o){}},console:new class{log(m,s,o){console.log(`${this.color(m)} ${o?"\x1B[35m"+o+"\x1B[0m ":""}${s}`)}color(m){switch(m){case"verbose":return"\x1B[34;40mv\x1B[0m";case"info":return"\x1B[32mi\x1B[0m";case"warning":return"\x1B[30;43mw\x1B[0m";case"error":return"\x1B[31;40me\x1B[0m";case"fatal":return"\x1B[101mf\x1B[0m";default:throw new Error(`unsupported severity: ${m}`)}}}},i={provider:"console",minimalSeverity:"warning",logDateTime:!0,logSourceLocation:!1};let a={"":i};function l(m,s,o,c){if(s===void 0)return v=m,{verbose:l.verbose.bind(null,v),info:l.info.bind(null,v),warning:l.warning.bind(null,v),error:l.error.bind(null,v),fatal:l.fatal.bind(null,v)};if(o===void 0)u(m,s);else if(typeof o=="number"&&c===void 0)u(m,s);else if(typeof o=="string"&&c===void 0)u(m,o,0,s);else{if(typeof o!="string"||typeof c!="number")throw new TypeError("input is valid");u(m,o,0,s)}var v}function u(m,s,o,c){const v=a[c||""]||a[""];t[m]{_.then(async w=>{v&&await v.end(),b(w)},async w=>{v&&await v.end(),x(w)})});if(!y&&v){const b=v.end();if(b&&typeof b.then=="function")return new Promise((x,w)=>{b.then(()=>{x(_)},S=>{w(S)})})}return _}begin(m,s,o){if(!this._started)throw new Error("profiler is not started yet");if(o===void 0){const c=(0,e.now)();return this.flush(c),new d(m,s,c,v=>this.endSync(v))}{const c=o.beginTimer();return new d(m,s,0,async v=>this.end(v),c,o)}}async end(m){const s=await m.checkTimer();this._timingEvents.length=this._flushBatchSize||m-this._flushTime>=this._flushIntervalInMilliseconds){for(const s=this._flushPointer;this._flushPointerperformance.now():Date.now},2644:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Model=void 0;const n=t(5686),i=t(1446),a=t(7070),l=t(9395),u=t(2517);var d=l.onnxruntime.experimental.fbs;e.Model=class{constructor(){}load(f,m,s){if(!s)try{return void this.loadFromOnnxFormat(f,m)}catch(o){if(s!==void 0)throw o}this.loadFromOrtFormat(f,m)}loadFromOnnxFormat(f,m){const s=i.onnx.ModelProto.decode(f);if(u.LongUtil.longToNumber(s.irVersion)<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=s.opsetImport.map(o=>({domain:o.domain,version:u.LongUtil.longToNumber(o.version)})),this._graph=a.Graph.from(s.graph,m)}loadFromOrtFormat(f,m){const s=new n.flatbuffers.ByteBuffer(f),o=d.InferenceSession.getRootAsInferenceSession(s).model();if(u.LongUtil.longToNumber(o.irVersion())<3)throw new Error("only support ONNX model with IR_VERSION>=3");this._opsets=[];for(let c=0;c{Object.defineProperty(e,"__esModule",{value:!0}),e.FLOAT_TYPES=e.INT_TYPES=e.NUMBER_TYPES=void 0,e.NUMBER_TYPES=["float32","float64","int32","int16","int8","uint16","uint32","uint8"],e.INT_TYPES=["int32","int16","int8","uint16","uint32","uint8"],e.FLOAT_TYPES=["float32","float64"]},1047:(r,e)=>{function t(n,i){if(i.endsWith("+")){const a=Number.parseInt(i.substring(0,i.length-1),10);return!isNaN(a)&&a<=n}if(i.split("-").length===2){const a=i.split("-"),l=Number.parseInt(a[0],10),u=Number.parseInt(a[1],10);return!isNaN(l)&&!isNaN(u)&&l<=n&&n<=u}return Number.parseInt(i,10)===n}Object.defineProperty(e,"__esModule",{value:!0}),e.resolveOperator=void 0,e.resolveOperator=function(n,i,a){for(const l of a){const u=l[0],d=l[1],f=l[2],m=l[3],s=l[4];if(n.opType===u){for(const o of i)if((o.domain===d||o.domain==="ai.onnx"&&d==="")&&t(o.version,f))return{opImpl:m,opInit:s}}}throw new TypeError(`cannot resolve operator '${n.opType}' with opsets: ${i.map(l=>`${l.domain||"ai.onnx"} v${l.version}`).join(", ")}`)}},9395:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.onnxruntime=void 0;const n=t(5686);var i,a;i=e.onnxruntime||(e.onnxruntime={}),function(l){(function(u){u[u.UNDEFINED=0]="UNDEFINED",u[u.FLOAT=1]="FLOAT",u[u.INT=2]="INT",u[u.STRING=3]="STRING",u[u.TENSOR=4]="TENSOR",u[u.GRAPH=5]="GRAPH",u[u.FLOATS=6]="FLOATS",u[u.INTS=7]="INTS",u[u.STRINGS=8]="STRINGS",u[u.TENSORS=9]="TENSORS",u[u.GRAPHS=10]="GRAPHS",u[u.SPARSE_TENSOR=11]="SPARSE_TENSOR",u[u.SPARSE_TENSORS=12]="SPARSE_TENSORS"})(l.AttributeType||(l.AttributeType={}))}((a=i.experimental||(i.experimental={})).fbs||(a.fbs={})),function(l){(function(u){(function(d){(function(f){f[f.UNKNOWN=0]="UNKNOWN",f[f.VALUE=1]="VALUE",f[f.PARAM=2]="PARAM"})(d.DimensionValueType||(d.DimensionValueType={}))})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){(function(f){f[f.UNDEFINED=0]="UNDEFINED",f[f.FLOAT=1]="FLOAT",f[f.UINT8=2]="UINT8",f[f.INT8=3]="INT8",f[f.UINT16=4]="UINT16",f[f.INT16=5]="INT16",f[f.INT32=6]="INT32",f[f.INT64=7]="INT64",f[f.STRING=8]="STRING",f[f.BOOL=9]="BOOL",f[f.FLOAT16=10]="FLOAT16",f[f.DOUBLE=11]="DOUBLE",f[f.UINT32=12]="UINT32",f[f.UINT64=13]="UINT64",f[f.COMPLEX64=14]="COMPLEX64",f[f.COMPLEX128=15]="COMPLEX128",f[f.BFLOAT16=16]="BFLOAT16"})(d.TensorDataType||(d.TensorDataType={}))})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){(function(f){f[f.Primitive=0]="Primitive",f[f.Fused=1]="Fused"})(d.NodeType||(d.NodeType={}))})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){(function(f){f[f.NONE=0]="NONE",f[f.tensor_type=1]="tensor_type",f[f.sequence_type=2]="sequence_type",f[f.map_type=3]="map_type"})(d.TypeInfoValue||(d.TypeInfoValue={}))})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsShape(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsShape(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}dim(s,o){let c=this.bb.__offset(this.bb_pos,4);return c?(o||new l.experimental.fbs.Dimension).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}dimLength(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__vector_len(this.bb_pos+s):0}static startShape(s){s.startObject(1)}static addDim(s,o){s.addFieldOffset(0,o,0)}static createDimVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startDimVector(s,o){s.startVector(4,o,4)}static endShape(s){return s.endObject()}static createShape(s,o){return f.startShape(s),f.addDim(s,o),f.endShape(s)}}d.Shape=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsDimension(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsDimension(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}value(s){let o=this.bb.__offset(this.bb_pos,4);return o?(s||new l.experimental.fbs.DimensionValue).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}denotation(s){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,s):null}static startDimension(s){s.startObject(2)}static addValue(s,o){s.addFieldOffset(0,o,0)}static addDenotation(s,o){s.addFieldOffset(1,o,0)}static endDimension(s){return s.endObject()}static createDimension(s,o,c){return f.startDimension(s),f.addValue(s,o),f.addDenotation(s,c),f.endDimension(s)}}d.Dimension=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsDimensionValue(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsDimensionValue(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}dimType(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readInt8(this.bb_pos+s):l.experimental.fbs.DimensionValueType.UNKNOWN}dimValue(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readInt64(this.bb_pos+s):this.bb.createLong(0,0)}dimParam(s){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__string(this.bb_pos+o,s):null}static startDimensionValue(s){s.startObject(3)}static addDimType(s,o){s.addFieldInt8(0,o,l.experimental.fbs.DimensionValueType.UNKNOWN)}static addDimValue(s,o){s.addFieldInt64(1,o,s.createLong(0,0))}static addDimParam(s,o){s.addFieldOffset(2,o,0)}static endDimensionValue(s){return s.endObject()}static createDimensionValue(s,o,c,v){return f.startDimensionValue(s),f.addDimType(s,o),f.addDimValue(s,c),f.addDimParam(s,v),f.endDimensionValue(s)}}d.DimensionValue=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsTensorTypeAndShape(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsTensorTypeAndShape(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}elemType(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readInt32(this.bb_pos+s):l.experimental.fbs.TensorDataType.UNDEFINED}shape(s){let o=this.bb.__offset(this.bb_pos,6);return o?(s||new l.experimental.fbs.Shape).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startTensorTypeAndShape(s){s.startObject(2)}static addElemType(s,o){s.addFieldInt32(0,o,l.experimental.fbs.TensorDataType.UNDEFINED)}static addShape(s,o){s.addFieldOffset(1,o,0)}static endTensorTypeAndShape(s){return s.endObject()}static createTensorTypeAndShape(s,o,c){return f.startTensorTypeAndShape(s),f.addElemType(s,o),f.addShape(s,c),f.endTensorTypeAndShape(s)}}d.TensorTypeAndShape=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsMapType(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsMapType(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}keyType(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readInt32(this.bb_pos+s):l.experimental.fbs.TensorDataType.UNDEFINED}valueType(s){let o=this.bb.__offset(this.bb_pos,6);return o?(s||new l.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startMapType(s){s.startObject(2)}static addKeyType(s,o){s.addFieldInt32(0,o,l.experimental.fbs.TensorDataType.UNDEFINED)}static addValueType(s,o){s.addFieldOffset(1,o,0)}static endMapType(s){return s.endObject()}static createMapType(s,o,c){return f.startMapType(s),f.addKeyType(s,o),f.addValueType(s,c),f.endMapType(s)}}d.MapType=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsSequenceType(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsSequenceType(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}elemType(s){let o=this.bb.__offset(this.bb_pos,4);return o?(s||new l.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startSequenceType(s){s.startObject(1)}static addElemType(s,o){s.addFieldOffset(0,o,0)}static endSequenceType(s){return s.endObject()}static createSequenceType(s,o){return f.startSequenceType(s),f.addElemType(s,o),f.endSequenceType(s)}}d.SequenceType=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(u.fbs||(u.fbs={})).EdgeEnd=class{constructor(){this.bb=null,this.bb_pos=0}__init(d,f){return this.bb_pos=d,this.bb=f,this}nodeIndex(){return this.bb.readUint32(this.bb_pos)}srcArgIndex(){return this.bb.readInt32(this.bb_pos+4)}dstArgIndex(){return this.bb.readInt32(this.bb_pos+8)}static createEdgeEnd(d,f,m,s){return d.prep(4,12),d.writeInt32(s),d.writeInt32(m),d.writeInt32(f),d.offset()}}})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsNodeEdge(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsNodeEdge(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}nodeIndex(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readUint32(this.bb_pos+s):0}inputEdges(s,o){let c=this.bb.__offset(this.bb_pos,6);return c?(o||new l.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+c)+12*s,this.bb):null}inputEdgesLength(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__vector_len(this.bb_pos+s):0}outputEdges(s,o){let c=this.bb.__offset(this.bb_pos,8);return c?(o||new l.experimental.fbs.EdgeEnd).__init(this.bb.__vector(this.bb_pos+c)+12*s,this.bb):null}outputEdgesLength(){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__vector_len(this.bb_pos+s):0}static startNodeEdge(s){s.startObject(3)}static addNodeIndex(s,o){s.addFieldInt32(0,o,0)}static addInputEdges(s,o){s.addFieldOffset(1,o,0)}static startInputEdgesVector(s,o){s.startVector(12,o,4)}static addOutputEdges(s,o){s.addFieldOffset(2,o,0)}static startOutputEdgesVector(s,o){s.startVector(12,o,4)}static endNodeEdge(s){return s.endObject()}static createNodeEdge(s,o,c,v){return f.startNodeEdge(s),f.addNodeIndex(s,o),f.addInputEdges(s,c),f.addOutputEdges(s,v),f.endNodeEdge(s)}}d.NodeEdge=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsNode(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsNode(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}name(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}docString(s){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,s):null}domain(s){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__string(this.bb_pos+o,s):null}sinceVersion(){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.readInt32(this.bb_pos+s):0}index(){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.readUint32(this.bb_pos+s):0}opType(s){let o=this.bb.__offset(this.bb_pos,14);return o?this.bb.__string(this.bb_pos+o,s):null}type(){let s=this.bb.__offset(this.bb_pos,16);return s?this.bb.readInt32(this.bb_pos+s):l.experimental.fbs.NodeType.Primitive}executionProviderType(s){let o=this.bb.__offset(this.bb_pos,18);return o?this.bb.__string(this.bb_pos+o,s):null}inputs(s,o){let c=this.bb.__offset(this.bb_pos,20);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}inputsLength(){let s=this.bb.__offset(this.bb_pos,20);return s?this.bb.__vector_len(this.bb_pos+s):0}outputs(s,o){let c=this.bb.__offset(this.bb_pos,22);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}outputsLength(){let s=this.bb.__offset(this.bb_pos,22);return s?this.bb.__vector_len(this.bb_pos+s):0}attributes(s,o){let c=this.bb.__offset(this.bb_pos,24);return c?(o||new l.experimental.fbs.Attribute).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}attributesLength(){let s=this.bb.__offset(this.bb_pos,24);return s?this.bb.__vector_len(this.bb_pos+s):0}inputArgCounts(s){let o=this.bb.__offset(this.bb_pos,26);return o?this.bb.readInt32(this.bb.__vector(this.bb_pos+o)+4*s):0}inputArgCountsLength(){let s=this.bb.__offset(this.bb_pos,26);return s?this.bb.__vector_len(this.bb_pos+s):0}inputArgCountsArray(){let s=this.bb.__offset(this.bb_pos,26);return s?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+s),this.bb.__vector_len(this.bb_pos+s)):null}implicitInputs(s,o){let c=this.bb.__offset(this.bb_pos,28);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}implicitInputsLength(){let s=this.bb.__offset(this.bb_pos,28);return s?this.bb.__vector_len(this.bb_pos+s):0}static startNode(s){s.startObject(13)}static addName(s,o){s.addFieldOffset(0,o,0)}static addDocString(s,o){s.addFieldOffset(1,o,0)}static addDomain(s,o){s.addFieldOffset(2,o,0)}static addSinceVersion(s,o){s.addFieldInt32(3,o,0)}static addIndex(s,o){s.addFieldInt32(4,o,0)}static addOpType(s,o){s.addFieldOffset(5,o,0)}static addType(s,o){s.addFieldInt32(6,o,l.experimental.fbs.NodeType.Primitive)}static addExecutionProviderType(s,o){s.addFieldOffset(7,o,0)}static addInputs(s,o){s.addFieldOffset(8,o,0)}static createInputsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startInputsVector(s,o){s.startVector(4,o,4)}static addOutputs(s,o){s.addFieldOffset(9,o,0)}static createOutputsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startOutputsVector(s,o){s.startVector(4,o,4)}static addAttributes(s,o){s.addFieldOffset(10,o,0)}static createAttributesVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startAttributesVector(s,o){s.startVector(4,o,4)}static addInputArgCounts(s,o){s.addFieldOffset(11,o,0)}static createInputArgCountsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addInt32(o[c]);return s.endVector()}static startInputArgCountsVector(s,o){s.startVector(4,o,4)}static addImplicitInputs(s,o){s.addFieldOffset(12,o,0)}static createImplicitInputsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startImplicitInputsVector(s,o){s.startVector(4,o,4)}static endNode(s){return s.endObject()}static createNode(s,o,c,v,y,_,b,x,w,S,T,E,M,P){return f.startNode(s),f.addName(s,o),f.addDocString(s,c),f.addDomain(s,v),f.addSinceVersion(s,y),f.addIndex(s,_),f.addOpType(s,b),f.addType(s,x),f.addExecutionProviderType(s,w),f.addInputs(s,S),f.addOutputs(s,T),f.addAttributes(s,E),f.addInputArgCounts(s,M),f.addImplicitInputs(s,P),f.endNode(s)}}d.Node=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsValueInfo(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsValueInfo(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}name(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}docString(s){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,s):null}type(s){let o=this.bb.__offset(this.bb_pos,8);return o?(s||new l.experimental.fbs.TypeInfo).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startValueInfo(s){s.startObject(3)}static addName(s,o){s.addFieldOffset(0,o,0)}static addDocString(s,o){s.addFieldOffset(1,o,0)}static addType(s,o){s.addFieldOffset(2,o,0)}static endValueInfo(s){return s.endObject()}static createValueInfo(s,o,c,v){return f.startValueInfo(s),f.addName(s,o),f.addDocString(s,c),f.addType(s,v),f.endValueInfo(s)}}d.ValueInfo=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsTypeInfo(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsTypeInfo(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}denotation(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}valueType(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readUint8(this.bb_pos+s):l.experimental.fbs.TypeInfoValue.NONE}value(s){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__union(s,this.bb_pos+o):null}static startTypeInfo(s){s.startObject(3)}static addDenotation(s,o){s.addFieldOffset(0,o,0)}static addValueType(s,o){s.addFieldInt8(1,o,l.experimental.fbs.TypeInfoValue.NONE)}static addValue(s,o){s.addFieldOffset(2,o,0)}static endTypeInfo(s){return s.endObject()}static createTypeInfo(s,o,c,v){return f.startTypeInfo(s),f.addDenotation(s,o),f.addValueType(s,c),f.addValue(s,v),f.endTypeInfo(s)}}d.TypeInfo=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsOperatorSetId(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsOperatorSetId(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}domain(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}version(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.readInt64(this.bb_pos+s):this.bb.createLong(0,0)}static startOperatorSetId(s){s.startObject(2)}static addDomain(s,o){s.addFieldOffset(0,o,0)}static addVersion(s,o){s.addFieldInt64(1,o,s.createLong(0,0))}static endOperatorSetId(s){return s.endObject()}static createOperatorSetId(s,o,c){return f.startOperatorSetId(s),f.addDomain(s,o),f.addVersion(s,c),f.endOperatorSetId(s)}}d.OperatorSetId=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsTensor(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsTensor(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}name(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}docString(s){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,s):null}dims(s){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.readInt64(this.bb.__vector(this.bb_pos+o)+8*s):this.bb.createLong(0,0)}dimsLength(){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__vector_len(this.bb_pos+s):0}dataType(){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.readInt32(this.bb_pos+s):l.experimental.fbs.TensorDataType.UNDEFINED}rawData(s){let o=this.bb.__offset(this.bb_pos,12);return o?this.bb.readUint8(this.bb.__vector(this.bb_pos+o)+s):0}rawDataLength(){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.__vector_len(this.bb_pos+s):0}rawDataArray(){let s=this.bb.__offset(this.bb_pos,12);return s?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+s),this.bb.__vector_len(this.bb_pos+s)):null}stringData(s,o){let c=this.bb.__offset(this.bb_pos,14);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}stringDataLength(){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.__vector_len(this.bb_pos+s):0}static startTensor(s){s.startObject(6)}static addName(s,o){s.addFieldOffset(0,o,0)}static addDocString(s,o){s.addFieldOffset(1,o,0)}static addDims(s,o){s.addFieldOffset(2,o,0)}static createDimsVector(s,o){s.startVector(8,o.length,8);for(let c=o.length-1;c>=0;c--)s.addInt64(o[c]);return s.endVector()}static startDimsVector(s,o){s.startVector(8,o,8)}static addDataType(s,o){s.addFieldInt32(3,o,l.experimental.fbs.TensorDataType.UNDEFINED)}static addRawData(s,o){s.addFieldOffset(4,o,0)}static createRawDataVector(s,o){s.startVector(1,o.length,1);for(let c=o.length-1;c>=0;c--)s.addInt8(o[c]);return s.endVector()}static startRawDataVector(s,o){s.startVector(1,o,1)}static addStringData(s,o){s.addFieldOffset(5,o,0)}static createStringDataVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startStringDataVector(s,o){s.startVector(4,o,4)}static endTensor(s){return s.endObject()}static createTensor(s,o,c,v,y,_,b){return f.startTensor(s),f.addName(s,o),f.addDocString(s,c),f.addDims(s,v),f.addDataType(s,y),f.addRawData(s,_),f.addStringData(s,b),f.endTensor(s)}}d.Tensor=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsSparseTensor(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsSparseTensor(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}values(s){let o=this.bb.__offset(this.bb_pos,4);return o?(s||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}indices(s){let o=this.bb.__offset(this.bb_pos,6);return o?(s||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}dims(s){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.readInt64(this.bb.__vector(this.bb_pos+o)+8*s):this.bb.createLong(0,0)}dimsLength(){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__vector_len(this.bb_pos+s):0}static startSparseTensor(s){s.startObject(3)}static addValues(s,o){s.addFieldOffset(0,o,0)}static addIndices(s,o){s.addFieldOffset(1,o,0)}static addDims(s,o){s.addFieldOffset(2,o,0)}static createDimsVector(s,o){s.startVector(8,o.length,8);for(let c=o.length-1;c>=0;c--)s.addInt64(o[c]);return s.endVector()}static startDimsVector(s,o){s.startVector(8,o,8)}static endSparseTensor(s){return s.endObject()}static createSparseTensor(s,o,c,v){return f.startSparseTensor(s),f.addValues(s,o),f.addIndices(s,c),f.addDims(s,v),f.endSparseTensor(s)}}d.SparseTensor=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsAttribute(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsAttribute(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}name(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}docString(s){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,s):null}type(){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.readInt32(this.bb_pos+s):l.experimental.fbs.AttributeType.UNDEFINED}f(){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.readFloat32(this.bb_pos+s):0}i(){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.readInt64(this.bb_pos+s):this.bb.createLong(0,0)}s(s){let o=this.bb.__offset(this.bb_pos,14);return o?this.bb.__string(this.bb_pos+o,s):null}t(s){let o=this.bb.__offset(this.bb_pos,16);return o?(s||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}g(s){let o=this.bb.__offset(this.bb_pos,18);return o?(s||new l.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}floats(s){let o=this.bb.__offset(this.bb_pos,20);return o?this.bb.readFloat32(this.bb.__vector(this.bb_pos+o)+4*s):0}floatsLength(){let s=this.bb.__offset(this.bb_pos,20);return s?this.bb.__vector_len(this.bb_pos+s):0}floatsArray(){let s=this.bb.__offset(this.bb_pos,20);return s?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+s),this.bb.__vector_len(this.bb_pos+s)):null}ints(s){let o=this.bb.__offset(this.bb_pos,22);return o?this.bb.readInt64(this.bb.__vector(this.bb_pos+o)+8*s):this.bb.createLong(0,0)}intsLength(){let s=this.bb.__offset(this.bb_pos,22);return s?this.bb.__vector_len(this.bb_pos+s):0}strings(s,o){let c=this.bb.__offset(this.bb_pos,24);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}stringsLength(){let s=this.bb.__offset(this.bb_pos,24);return s?this.bb.__vector_len(this.bb_pos+s):0}tensors(s,o){let c=this.bb.__offset(this.bb_pos,26);return c?(o||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}tensorsLength(){let s=this.bb.__offset(this.bb_pos,26);return s?this.bb.__vector_len(this.bb_pos+s):0}graphs(s,o){let c=this.bb.__offset(this.bb_pos,28);return c?(o||new l.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}graphsLength(){let s=this.bb.__offset(this.bb_pos,28);return s?this.bb.__vector_len(this.bb_pos+s):0}static startAttribute(s){s.startObject(13)}static addName(s,o){s.addFieldOffset(0,o,0)}static addDocString(s,o){s.addFieldOffset(1,o,0)}static addType(s,o){s.addFieldInt32(2,o,l.experimental.fbs.AttributeType.UNDEFINED)}static addF(s,o){s.addFieldFloat32(3,o,0)}static addI(s,o){s.addFieldInt64(4,o,s.createLong(0,0))}static addS(s,o){s.addFieldOffset(5,o,0)}static addT(s,o){s.addFieldOffset(6,o,0)}static addG(s,o){s.addFieldOffset(7,o,0)}static addFloats(s,o){s.addFieldOffset(8,o,0)}static createFloatsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addFloat32(o[c]);return s.endVector()}static startFloatsVector(s,o){s.startVector(4,o,4)}static addInts(s,o){s.addFieldOffset(9,o,0)}static createIntsVector(s,o){s.startVector(8,o.length,8);for(let c=o.length-1;c>=0;c--)s.addInt64(o[c]);return s.endVector()}static startIntsVector(s,o){s.startVector(8,o,8)}static addStrings(s,o){s.addFieldOffset(10,o,0)}static createStringsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startStringsVector(s,o){s.startVector(4,o,4)}static addTensors(s,o){s.addFieldOffset(11,o,0)}static createTensorsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startTensorsVector(s,o){s.startVector(4,o,4)}static addGraphs(s,o){s.addFieldOffset(12,o,0)}static createGraphsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startGraphsVector(s,o){s.startVector(4,o,4)}static endAttribute(s){return s.endObject()}static createAttribute(s,o,c,v,y,_,b,x,w,S,T,E,M,P){return f.startAttribute(s),f.addName(s,o),f.addDocString(s,c),f.addType(s,v),f.addF(s,y),f.addI(s,_),f.addS(s,b),f.addT(s,x),f.addG(s,w),f.addFloats(s,S),f.addInts(s,T),f.addStrings(s,E),f.addTensors(s,M),f.addGraphs(s,P),f.endAttribute(s)}}d.Attribute=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsGraph(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsGraph(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}initializers(s,o){let c=this.bb.__offset(this.bb_pos,4);return c?(o||new l.experimental.fbs.Tensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}initializersLength(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__vector_len(this.bb_pos+s):0}nodeArgs(s,o){let c=this.bb.__offset(this.bb_pos,6);return c?(o||new l.experimental.fbs.ValueInfo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}nodeArgsLength(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__vector_len(this.bb_pos+s):0}nodes(s,o){let c=this.bb.__offset(this.bb_pos,8);return c?(o||new l.experimental.fbs.Node).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}nodesLength(){let s=this.bb.__offset(this.bb_pos,8);return s?this.bb.__vector_len(this.bb_pos+s):0}maxNodeIndex(){let s=this.bb.__offset(this.bb_pos,10);return s?this.bb.readUint32(this.bb_pos+s):0}nodeEdges(s,o){let c=this.bb.__offset(this.bb_pos,12);return c?(o||new l.experimental.fbs.NodeEdge).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}nodeEdgesLength(){let s=this.bb.__offset(this.bb_pos,12);return s?this.bb.__vector_len(this.bb_pos+s):0}inputs(s,o){let c=this.bb.__offset(this.bb_pos,14);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}inputsLength(){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.__vector_len(this.bb_pos+s):0}outputs(s,o){let c=this.bb.__offset(this.bb_pos,16);return c?this.bb.__string(this.bb.__vector(this.bb_pos+c)+4*s,o):null}outputsLength(){let s=this.bb.__offset(this.bb_pos,16);return s?this.bb.__vector_len(this.bb_pos+s):0}sparseInitializers(s,o){let c=this.bb.__offset(this.bb_pos,18);return c?(o||new l.experimental.fbs.SparseTensor).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}sparseInitializersLength(){let s=this.bb.__offset(this.bb_pos,18);return s?this.bb.__vector_len(this.bb_pos+s):0}static startGraph(s){s.startObject(8)}static addInitializers(s,o){s.addFieldOffset(0,o,0)}static createInitializersVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startInitializersVector(s,o){s.startVector(4,o,4)}static addNodeArgs(s,o){s.addFieldOffset(1,o,0)}static createNodeArgsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startNodeArgsVector(s,o){s.startVector(4,o,4)}static addNodes(s,o){s.addFieldOffset(2,o,0)}static createNodesVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startNodesVector(s,o){s.startVector(4,o,4)}static addMaxNodeIndex(s,o){s.addFieldInt32(3,o,0)}static addNodeEdges(s,o){s.addFieldOffset(4,o,0)}static createNodeEdgesVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startNodeEdgesVector(s,o){s.startVector(4,o,4)}static addInputs(s,o){s.addFieldOffset(5,o,0)}static createInputsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startInputsVector(s,o){s.startVector(4,o,4)}static addOutputs(s,o){s.addFieldOffset(6,o,0)}static createOutputsVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startOutputsVector(s,o){s.startVector(4,o,4)}static addSparseInitializers(s,o){s.addFieldOffset(7,o,0)}static createSparseInitializersVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startSparseInitializersVector(s,o){s.startVector(4,o,4)}static endGraph(s){return s.endObject()}static createGraph(s,o,c,v,y,_,b,x,w){return f.startGraph(s),f.addInitializers(s,o),f.addNodeArgs(s,c),f.addNodes(s,v),f.addMaxNodeIndex(s,y),f.addNodeEdges(s,_),f.addInputs(s,b),f.addOutputs(s,x),f.addSparseInitializers(s,w),f.endGraph(s)}}d.Graph=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsModel(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsModel(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}irVersion(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.readInt64(this.bb_pos+s):this.bb.createLong(0,0)}opsetImport(s,o){let c=this.bb.__offset(this.bb_pos,6);return c?(o||new l.experimental.fbs.OperatorSetId).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}opsetImportLength(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__vector_len(this.bb_pos+s):0}producerName(s){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__string(this.bb_pos+o,s):null}producerVersion(s){let o=this.bb.__offset(this.bb_pos,10);return o?this.bb.__string(this.bb_pos+o,s):null}domain(s){let o=this.bb.__offset(this.bb_pos,12);return o?this.bb.__string(this.bb_pos+o,s):null}modelVersion(){let s=this.bb.__offset(this.bb_pos,14);return s?this.bb.readInt64(this.bb_pos+s):this.bb.createLong(0,0)}docString(s){let o=this.bb.__offset(this.bb_pos,16);return o?this.bb.__string(this.bb_pos+o,s):null}graph(s){let o=this.bb.__offset(this.bb_pos,18);return o?(s||new l.experimental.fbs.Graph).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}graphDocString(s){let o=this.bb.__offset(this.bb_pos,20);return o?this.bb.__string(this.bb_pos+o,s):null}static startModel(s){s.startObject(9)}static addIrVersion(s,o){s.addFieldInt64(0,o,s.createLong(0,0))}static addOpsetImport(s,o){s.addFieldOffset(1,o,0)}static createOpsetImportVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startOpsetImportVector(s,o){s.startVector(4,o,4)}static addProducerName(s,o){s.addFieldOffset(2,o,0)}static addProducerVersion(s,o){s.addFieldOffset(3,o,0)}static addDomain(s,o){s.addFieldOffset(4,o,0)}static addModelVersion(s,o){s.addFieldInt64(5,o,s.createLong(0,0))}static addDocString(s,o){s.addFieldOffset(6,o,0)}static addGraph(s,o){s.addFieldOffset(7,o,0)}static addGraphDocString(s,o){s.addFieldOffset(8,o,0)}static endModel(s){return s.endObject()}static createModel(s,o,c,v,y,_,b,x,w,S){return f.startModel(s),f.addIrVersion(s,o),f.addOpsetImport(s,c),f.addProducerName(s,v),f.addProducerVersion(s,y),f.addDomain(s,_),f.addModelVersion(s,b),f.addDocString(s,x),f.addGraph(s,w),f.addGraphDocString(s,S),f.endModel(s)}}d.Model=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsKernelCreateInfos(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsKernelCreateInfos(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}nodeIndices(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.readUint32(this.bb.__vector(this.bb_pos+o)+4*s):0}nodeIndicesLength(){let s=this.bb.__offset(this.bb_pos,4);return s?this.bb.__vector_len(this.bb_pos+s):0}nodeIndicesArray(){let s=this.bb.__offset(this.bb_pos,4);return s?new Uint32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+s),this.bb.__vector_len(this.bb_pos+s)):null}kernelDefHashes(s){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.readUint64(this.bb.__vector(this.bb_pos+o)+8*s):this.bb.createLong(0,0)}kernelDefHashesLength(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__vector_len(this.bb_pos+s):0}static startKernelCreateInfos(s){s.startObject(2)}static addNodeIndices(s,o){s.addFieldOffset(0,o,0)}static createNodeIndicesVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addInt32(o[c]);return s.endVector()}static startNodeIndicesVector(s,o){s.startVector(4,o,4)}static addKernelDefHashes(s,o){s.addFieldOffset(1,o,0)}static createKernelDefHashesVector(s,o){s.startVector(8,o.length,8);for(let c=o.length-1;c>=0;c--)s.addInt64(o[c]);return s.endVector()}static startKernelDefHashesVector(s,o){s.startVector(8,o,8)}static endKernelCreateInfos(s){return s.endObject()}static createKernelCreateInfos(s,o,c){return f.startKernelCreateInfos(s),f.addNodeIndices(s,o),f.addKernelDefHashes(s,c),f.endKernelCreateInfos(s)}}d.KernelCreateInfos=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsSubGraphSessionState(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsSubGraphSessionState(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}graphId(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}sessionState(s){let o=this.bb.__offset(this.bb_pos,6);return o?(s||new l.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startSubGraphSessionState(s){s.startObject(2)}static addGraphId(s,o){s.addFieldOffset(0,o,0)}static addSessionState(s,o){s.addFieldOffset(1,o,0)}static endSubGraphSessionState(s){let o=s.endObject();return s.requiredField(o,4),o}static createSubGraphSessionState(s,o,c){return f.startSubGraphSessionState(s),f.addGraphId(s,o),f.addSessionState(s,c),f.endSubGraphSessionState(s)}}d.SubGraphSessionState=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsSessionState(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsSessionState(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}kernels(s){let o=this.bb.__offset(this.bb_pos,4);return o?(s||new l.experimental.fbs.KernelCreateInfos).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}subGraphSessionStates(s,o){let c=this.bb.__offset(this.bb_pos,6);return c?(o||new l.experimental.fbs.SubGraphSessionState).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+4*s),this.bb):null}subGraphSessionStatesLength(){let s=this.bb.__offset(this.bb_pos,6);return s?this.bb.__vector_len(this.bb_pos+s):0}static startSessionState(s){s.startObject(2)}static addKernels(s,o){s.addFieldOffset(0,o,0)}static addSubGraphSessionStates(s,o){s.addFieldOffset(1,o,0)}static createSubGraphSessionStatesVector(s,o){s.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)s.addOffset(o[c]);return s.endVector()}static startSubGraphSessionStatesVector(s,o){s.startVector(4,o,4)}static endSessionState(s){return s.endObject()}static createSessionState(s,o,c){return f.startSessionState(s),f.addKernels(s,o),f.addSubGraphSessionStates(s,c),f.endSessionState(s)}}d.SessionState=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={})),function(l){(function(u){(function(d){class f{constructor(){this.bb=null,this.bb_pos=0}__init(s,o){return this.bb_pos=s,this.bb=o,this}static getRootAsInferenceSession(s,o){return(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static getSizePrefixedRootAsInferenceSession(s,o){return s.setPosition(s.position()+n.flatbuffers.SIZE_PREFIX_LENGTH),(o||new f).__init(s.readInt32(s.position())+s.position(),s)}static bufferHasIdentifier(s){return s.__has_identifier("ORTM")}ortVersion(s){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,s):null}model(s){let o=this.bb.__offset(this.bb_pos,6);return o?(s||new l.experimental.fbs.Model).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}sessionState(s){let o=this.bb.__offset(this.bb_pos,8);return o?(s||new l.experimental.fbs.SessionState).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}static startInferenceSession(s){s.startObject(3)}static addOrtVersion(s,o){s.addFieldOffset(0,o,0)}static addModel(s,o){s.addFieldOffset(1,o,0)}static addSessionState(s,o){s.addFieldOffset(2,o,0)}static endInferenceSession(s){return s.endObject()}static finishInferenceSessionBuffer(s,o){s.finish(o,"ORTM")}static finishSizePrefixedInferenceSessionBuffer(s,o){s.finish(o,"ORTM",!0)}static createInferenceSession(s,o,c,v){return f.startInferenceSession(s),f.addOrtVersion(s,o),f.addModel(s,c),f.addSessionState(s,v),f.endInferenceSession(s)}}d.InferenceSession=f})(u.fbs||(u.fbs={}))})(l.experimental||(l.experimental={}))}(e.onnxruntime||(e.onnxruntime={}))},7448:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxjsSessionHandler=void 0;const n=t(1670),i=t(9162);e.OnnxjsSessionHandler=class{constructor(a){this.session=a,this.inputNames=this.session.inputNames,this.outputNames=this.session.outputNames}async dispose(){}async run(a,l,u){const d=new Map;for(const s in a)if(Object.hasOwnProperty.call(a,s)){const o=a[s];d.set(s,new i.Tensor(o.dims,o.type,void 0,void 0,o.data))}const f=await this.session.run(d),m={};return f.forEach((s,o)=>{m[o]=new n.Tensor(s.type,s.data,s.dims)}),m}startProfiling(){this.session.startProfiling()}endProfiling(){this.session.endProfiling()}}},6919:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;const n=t(7067),i=t(1296),a=t(7091),l=t(1036),u=t(6231),d=t(2644);e.Session=class{constructor(f={}){this._initialized=!1,this.backendHint=f.backendHint,this.profiler=u.Profiler.create(f.profiler),this.context={profiler:this.profiler,graphInputTypes:[],graphInputDims:[]}}get inputNames(){return this._model.graph.getInputNames()}get outputNames(){return this._model.graph.getOutputNames()}startProfiling(){this.profiler.start()}endProfiling(){this.profiler.stop()}async loadModel(f,m,s){await this.profiler.event("session","Session.loadModel",async()=>{const o=await(0,a.resolveBackend)(this.backendHint);if(this.sessionHandler=o.createSessionHandler(this.context),this._model=new d.Model,typeof f=="string"){const c=f.endsWith(".ort");if(typeof fetch>"u"){const v=await(0,i.promisify)(n.readFile)(f);this.initialize(v,c)}else{const v=await fetch(f),y=await v.arrayBuffer();this.initialize(new Uint8Array(y),c)}}else if(ArrayBuffer.isView(f))this.initialize(f);else{const c=new Uint8Array(f,m||0,s||f.byteLength);this.initialize(c)}})}initialize(f,m){if(this._initialized)throw new Error("already initialized");this.profiler.event("session","Session.initialize",()=>{const s=this.sessionHandler.transformGraph?this.sessionHandler:void 0;this._model.load(f,s,m),this.sessionHandler.onGraphInitialized&&this.sessionHandler.onGraphInitialized(this._model.graph),this.initializeOps(this._model.graph),this._executionPlan=new l.ExecutionPlan(this._model.graph,this._ops,this.profiler)}),this._initialized=!0}async run(f){if(!this._initialized)throw new Error("session not initialized yet");return this.profiler.event("session","Session.run",async()=>{const m=this.normalizeAndValidateInputs(f),s=await this._executionPlan.execute(this.sessionHandler,m);return this.createOutput(s)})}normalizeAndValidateInputs(f){const m=this._model.graph.getInputNames();if(Array.isArray(f)){if(f.length!==m.length)throw new Error(`incorrect input array length: expected ${m.length} but got ${f.length}`)}else{if(f.size!==m.length)throw new Error(`incorrect input map size: expected ${m.length} but got ${f.size}`);const s=new Array(f.size);let o=0;for(let c=0;ctypeof P=="string")))throw new TypeError("cache should be a string array");M&&(this.cache=new Array(E))}else{if(S!==void 0){const P=o(b);if(!(S instanceof P))throw new TypeError(`cache should be type ${P.name}`)}if(M){const P=new ArrayBuffer(E*function(A){switch(A){case"bool":case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;case"float64":return 8;default:throw new Error(`cannot calculate sizeof() on type ${A}`)}}(b));this.cache=function(A,C){return new(o(C))(A)}(P,b)}}}static fromProto(_){if(!_)throw new Error("cannot construct Value from an empty tensor");const b=d.ProtoUtil.tensorDataTypeFromProto(_.dataType),x=d.ProtoUtil.tensorDimsFromProto(_.dims),w=new m(x,b);if(b==="string")_.stringData.forEach((S,T)=>{w.data[T]=(0,d.decodeUtf8String)(S)});else if(_.rawData&&typeof _.rawData.byteLength=="number"&&_.rawData.byteLength>0){const S=w.data,T=new DataView(_.rawData.buffer,_.rawData.byteOffset,_.rawData.byteLength),E=s(_.dataType),M=_.rawData.byteLength/E;if(_.rawData.byteLength%E!=0)throw new Error("invalid buffer length");if(S.length!==M)throw new Error("buffer length mismatch");for(let P=0;P0){const S=w.data,T=new DataView(_.rawDataArray().buffer,_.rawDataArray().byteOffset,_.rawDataLength()),E=s(_.dataType()),M=_.rawDataLength()/E;if(_.rawDataLength()%E!=0)throw new Error("invalid buffer length");if(S.length!==M)throw new Error("buffer length mismatch");for(let P=0;P1&&C>1)return;M[E-P]=Math.max(A,C)}return M}static index(b,x){const w=new Array(x.length);return f.fillIndex(b,x,w),w}static fillIndex(b,x,w){const S=b.length-x.length;for(let T=0;T=0;H--)A[H]=k%E[H],k=Math.floor(k/E[H]);W||(f.fillIndex(A,b.dims,C),j=b.get(C)),L||(f.fillIndex(A,x.dims,D),I=x.get(D)),P.set(A,w(j,I))}}return P}}static isValidBroadcast(b,x){const w=b.length,S=x.length;if(w>S)return!1;for(let T=1;T<=w;T++)if(b[w-T]!==1&&b[w-T]!==x[S-T])return!1;return!0}static getBroadcastDims(b,x){const w=b.length,S=[];for(let T=0;T1&&M===1&&S.unshift(E)}return S}}e.BroadcastUtil=f,e.arrayCopyHelper=function(_,b,x,w,S){if(w<0||w>=b.length)throw new Error("sourceIndex out of bounds");if(x<0||x>=_.length)throw new Error("targetIndex out of bounds");if(w+S>b.length)throw new Error("source indices to be copied are outside bounds");if(x+S>_.length)throw new Error("target array is too small to hold result");for(let T=0;Ta.default.isLong(x)?x.toNumber():x)}static tensorValueTypeFromProto(b){return{tensorType:m.tensorDataTypeFromProto(b.elemType),shape:{dims:m.tensorDimsFromProto(b.shape.dim.map(x=>x.dimValue))}}}static tensorDimsFromORTFormat(b){const x=[];for(let w=0;wb.length)throw new Error(`invalid dimension of ${x} for sizeFromDimension as Tensor has ${b.length} dimensions.`);return o.getSizeFromDimensionRange(b,x,b.length)}static sizeToDimension(b,x){if(x<0||x>b.length)throw new Error(`invalid dimension of ${x} for sizeToDimension as Tensor has ${b.length} dimensions.`);return o.getSizeFromDimensionRange(b,0,x)}static getSizeFromDimensionRange(b,x,w){let S=1;for(let T=x;T=0;--S)w[S]=w[S+1]*b[S+1];return w}static transpose(b){return b.slice().reverse()}static indicesToOffset(b,x,w){w===void 0&&(w=b.length);let S=0;for(let T=0;T=x)throw new Error("unsupported axis for this operation.");return b<0?b+x:b}static normalizeAxes(b,x){return b.map(w=>this.normalizeAxis(w,x))}static incrementIndex(b,x,w){if(x.length===0||b.length===0)throw new Error("Index incrementing unsupported for scalar Tensor");if(w===void 0)w=x.length;else if(w<=0||w>x.length)throw new Error("Incorrect axis to increment on");for(let S=w-1;S>=0&&(b[S]++,!(b[S]=b.length)throw new Error("the dimension with value zero exceeds the dimension size of the input tensor");S[P]=b[P]}else S[P]=x[P];E*=S[P]}}const M=o.size(b);if(T!==-1){if(M%E!=0)throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${b}] Output shape: [${x}]`);S[T]=M/E}else if(E!==M)throw new Error("reshapedDims and originalDims don't have matching sizes");return S}static sortBasedOnPerm(b,x){return x?x.map(w=>b[w]):b.slice().reverse()}static padShape(b,x){const w=b.length;return b.map((S,T)=>S+x[T]+x[T+w])}static areEqual(b,x){return b.length===x.length&&b.every((w,S)=>w===x[S])}static validateDimsAndCalcSize(b){if(b.length>6)throw new TypeError("Only rank 0 to 6 is supported for tensor shape.");let x=1;for(const w of b){if(!Number.isInteger(w))throw new TypeError(`Invalid shape: ${w} is not an integer`);if(w<0||w>2147483647)throw new TypeError(`Invalid shape: length ${w} is not allowed`);x*=w}return x}static flattenShape(b,x){x<0&&(x+=b.length);const w=b.reduce((T,E)=>T*E,1),S=b.slice(x).reduce((T,E)=>T*E,1);return[w/S,S]}static squeezeShape(b,x){const w=new Array;x=o.normalizeAxes(x,b.length);for(let S=0;S=0;if(T&&b[S]!==1)throw new Error("squeeze an axis of size different than 1");(x.length===0&&b[S]>1||x.length>0&&!T)&&w.push(b[S])}return w}static unsqueezeShape(b,x){const w=new Array(b.length+x.length);w.fill(0);for(let T=0;T=w.length)throw new Error("'axes' has an out of range axis");if(w[E]!==0)throw new Error("'axes' has a duplicate axis");w[E]=1}let S=0;for(let T=0;T=b.length)throw new Error("sourceIndex out of bounds");if(x<0||x>=_.length)throw new Error("targetIndex out of bounds");if(w+S>b.length)throw new Error("source indices to be copied are outside bounds");if(x+S>_.length)throw new Error("target array is too small to hold result");for(let T=0;T=b.length)throw new Error("sourceIndex out of bounds");if(x<0||x>=_.length)throw new Error("targetIndex out of bounds");if(w+S>b.length)throw new Error("source indices to be copied are outside bounds");if(x+S>_.length)throw new Error("target array is too small to hold result");for(let E=0;E=b.length)throw new Error("sourceIndex out of bounds");if(x<0||x>=_.length)throw new Error("targetIndex out of bounds");if(w+S>b.length)throw new Error("source indices to be copied are outside bounds");if(x+S>_.length)throw new Error("target array is too small to hold result");for(let E=0;E=b.length)throw new Error("sourceIndex out of bounds");if(x<0||x>=_.length)throw new Error("targetIndex out of bounds");if(w+S>b.length)throw new Error("source indices to be copied are outside bounds");if(x+S>_.length)throw new Error("target array is too small to hold result");for(let T=0;Tx.push(I));const M=v.calcReduceShape(E,x,!0),P=o.size(M),A=new u.Tensor(M,b.type),C=o.computeStrides(M),D=o.computeStrides(E),k=new Array(E.length);for(let j=0;j=x.length)return E(b[T]);const A=x[S],C=A>=w.length?1:o.size(w.slice(A+1));for(let D=0;DT!==0)}}e.ReduceUtil=v;class y{static adjustPoolAttributes(b,x,w,S,T,E){if(!b&&w.length!==x.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(b)for(let M=0;M=w.length?w.push(x[M+2]):w[M]=x[M+2];for(let M=0;M=w[M]||E[M+w.length]>=w[M])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(b,x,w,S,T,E){if(E){if(T.length!==2*(b.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(x.length!==b.length-2)throw new Error("length of strides should be the length of data dimensions");if(S.length!==b.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let M=0;M{Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,i,a)=>{if(typeof t=="object"&&t!==null){if(i.has(t))throw new Error("Circular reference in options");i.add(t)}Object.entries(t).forEach(([l,u])=>{const d=n?n+l:l;if(typeof u=="object")(0,e.iterateExtraOptions)(u,d+".",i,a);else if(typeof u=="string"||typeof u=="number")a(d,u.toString());else{if(typeof u!="boolean")throw new Error("Can't handle extra config type: "+typeof u);a(d,u?"1":"0")}})}},2157:function(r,e,t){var n,i=this&&this.__createBinding||(Object.create?function(C,D,k,j){j===void 0&&(j=k);var I=Object.getOwnPropertyDescriptor(D,k);I&&!("get"in I?!D.__esModule:I.writable||I.configurable)||(I={enumerable:!0,get:function(){return D[k]}}),Object.defineProperty(C,j,I)}:function(C,D,k,j){j===void 0&&(j=k),C[j]=D[k]}),a=this&&this.__setModuleDefault||(Object.create?function(C,D){Object.defineProperty(C,"default",{enumerable:!0,value:D})}:function(C,D){C.default=D}),l=this&&this.__importStar||function(C){if(C&&C.__esModule)return C;var D={};if(C!=null)for(var k in C)k!=="default"&&Object.prototype.hasOwnProperty.call(C,k)&&i(D,C,k);return a(D,C),D};Object.defineProperty(e,"__esModule",{value:!0}),e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=e.initWasm=void 0;const u=t(1670),d=l(t(349)),f=t(6361),m=()=>!!u.env.wasm.proxy&&typeof document<"u";let s,o,c,v=!1,y=!1,_=!1;const b=[],x=[],w=[],S=[],T=[],E=[],M=()=>{if(v||!y||_||!s)throw new Error("worker not ready")},P=C=>{switch(C.data.type){case"init-wasm":v=!1,C.data.err?(_=!0,o[1](C.data.err)):(y=!0,o[0]());break;case"init-ort":C.data.err?c[1](C.data.err):c[0]();break;case"create_allocate":C.data.err?b.shift()[1](C.data.err):b.shift()[0](C.data.out);break;case"create_finalize":C.data.err?x.shift()[1](C.data.err):x.shift()[0](C.data.out);break;case"create":C.data.err?w.shift()[1](C.data.err):w.shift()[0](C.data.out);break;case"release":C.data.err?S.shift()[1](C.data.err):S.shift()[0]();break;case"run":C.data.err?T.shift()[1](C.data.err):T.shift()[0](C.data.out);break;case"end-profiling":C.data.err?E.shift()[1](C.data.err):E.shift()[0]()}},A=typeof document<"u"?(n=document==null?void 0:document.currentScript)===null||n===void 0?void 0:n.src:void 0;e.initWasm=async()=>{if(m()){if(y)return;if(v)throw new Error("multiple calls to 'initWasm()' detected.");if(_)throw new Error("previous call to 'initWasm()' failed.");return v=!0,u.env.wasm.wasmPaths===void 0&&A&&A.indexOf("blob:")!==0&&(u.env.wasm.wasmPaths=A.substr(0,+A.lastIndexOf("/")+1)),new Promise((C,D)=>{s==null||s.terminate(),s=t(9710).Z(),s.onmessage=P,o=[C,D];const k={type:"init-wasm",in:u.env.wasm};s.postMessage(k)})}return(0,f.initializeWebAssembly)(u.env.wasm)},e.initOrt=async(C,D)=>{if(m())return M(),new Promise((k,j)=>{c=[k,j];const I={type:"init-ort",in:{numThreads:C,loggingLevel:D}};s.postMessage(I)});d.initOrt(C,D)},e.createSessionAllocate=async C=>m()?(M(),new Promise((D,k)=>{b.push([D,k]);const j={type:"create_allocate",in:{model:C}};s.postMessage(j,[C.buffer])})):d.createSessionAllocate(C),e.createSessionFinalize=async(C,D)=>m()?(M(),new Promise((k,j)=>{x.push([k,j]);const I={type:"create_finalize",in:{modeldata:C,options:D}};s.postMessage(I)})):d.createSessionFinalize(C,D),e.createSession=async(C,D)=>m()?(M(),new Promise((k,j)=>{w.push([k,j]);const I={type:"create",in:{model:C,options:D}};s.postMessage(I,[C.buffer])})):d.createSession(C,D),e.releaseSession=async C=>{if(m())return M(),new Promise((D,k)=>{S.push([D,k]);const j={type:"release",in:C};s.postMessage(j)});d.releaseSession(C)},e.run=async(C,D,k,j,I)=>m()?(M(),new Promise((W,L)=>{T.push([W,L]);const U={type:"run",in:{sessionId:C,inputIndices:D,inputs:k,outputIndices:j,options:I}};s.postMessage(U,d.extractTransferableBuffers(k))})):d.run(C,D,k,j,I),e.endProfiling=async C=>{if(m())return M(),new Promise((D,k)=>{E.push([D,k]);const j={type:"end-profiling",in:C};s.postMessage(j)});d.endProfiling(C)}},586:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const n=t(7967),i=t(4983),a=t(6361);e.setRunOptions=l=>{const u=(0,a.getInstance)();let d=0;const f=[],m=l||{};try{if((l==null?void 0:l.logSeverityLevel)===void 0)m.logSeverityLevel=2;else if(typeof l.logSeverityLevel!="number"||!Number.isInteger(l.logSeverityLevel)||l.logSeverityLevel<0||l.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${l.logSeverityLevel}`);if((l==null?void 0:l.logVerbosityLevel)===void 0)m.logVerbosityLevel=0;else if(typeof l.logVerbosityLevel!="number"||!Number.isInteger(l.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${l.logVerbosityLevel}`);(l==null?void 0:l.terminate)===void 0&&(m.terminate=!1);let s=0;if((l==null?void 0:l.tag)!==void 0&&(s=(0,i.allocWasmString)(l.tag,f)),d=u._OrtCreateRunOptions(m.logSeverityLevel,m.logVerbosityLevel,!!m.terminate,s),d===0)throw new Error("Can't create run options");return(l==null?void 0:l.extra)!==void 0&&(0,n.iterateExtraOptions)(l.extra,"",new WeakSet,(o,c)=>{const v=(0,i.allocWasmString)(o,f),y=(0,i.allocWasmString)(c,f);if(u._OrtAddRunConfigEntry(d,v,y)!==0)throw new Error(`Can't set a run config entry: ${o} - ${c}`)}),[d,f]}catch(s){throw d!==0&&u._OrtReleaseRunOptions(d),f.forEach(u._free),s}}},2306:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OnnxruntimeWebAssemblySessionHandler=void 0;const n=t(2806),i=t(1670),a=t(2850),l=t(2157);let u;e.OnnxruntimeWebAssemblySessionHandler=class{async createSessionAllocate(d){const f=await fetch(d),m=await f.arrayBuffer();return(0,l.createSessionAllocate)(new Uint8Array(m))}async loadModel(d,f){if(u||(await(0,l.initOrt)(i.env.wasm.numThreads,(m=>{switch(m){case"verbose":return 0;case"info":return 1;case"warning":return 2;case"error":return 3;case"fatal":return 4;default:throw new Error(`unsupported logging level: ${m}`)}})(i.env.logLevel)),u=!0),typeof d=="string")if(typeof fetch>"u"){const m=await(0,a.promisify)(n.readFile)(d);[this.sessionId,this.inputNames,this.outputNames]=await(0,l.createSession)(m,f)}else{const m=await this.createSessionAllocate(d);[this.sessionId,this.inputNames,this.outputNames]=await(0,l.createSessionFinalize)(m,f)}else[this.sessionId,this.inputNames,this.outputNames]=await(0,l.createSession)(d,f)}async dispose(){return(0,l.releaseSession)(this.sessionId)}async run(d,f,m){const s=[],o=[];Object.entries(d).forEach(_=>{const b=_[0],x=_[1],w=this.inputNames.indexOf(b);if(w===-1)throw new Error(`invalid input '${b}'`);s.push(x),o.push(w)});const c=[];Object.entries(f).forEach(_=>{const b=_[0],x=this.outputNames.indexOf(b);if(x===-1)throw new Error(`invalid output '${b}'`);c.push(x)});const v=await(0,l.run)(this.sessionId,o,s.map(_=>[_.type,_.dims,_.data]),c,m),y={};for(let _=0;_{Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const n=t(7967),i=t(4983),a=t(6361);e.setSessionOptions=l=>{const u=(0,a.getInstance)();let d=0;const f=[],m=l||{};(s=>{s.extra||(s.extra={}),s.extra.session||(s.extra.session={});const o=s.extra.session;o.use_ort_model_bytes_directly||(o.use_ort_model_bytes_directly="1")})(m);try{(l==null?void 0:l.graphOptimizationLevel)===void 0&&(m.graphOptimizationLevel="all");const s=(v=>{switch(v){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${v}`)}})(m.graphOptimizationLevel);(l==null?void 0:l.enableCpuMemArena)===void 0&&(m.enableCpuMemArena=!0),(l==null?void 0:l.enableMemPattern)===void 0&&(m.enableMemPattern=!0),(l==null?void 0:l.executionMode)===void 0&&(m.executionMode="sequential");const o=(v=>{switch(v){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${v}`)}})(m.executionMode);let c=0;if((l==null?void 0:l.logId)!==void 0&&(c=(0,i.allocWasmString)(l.logId,f)),(l==null?void 0:l.logSeverityLevel)===void 0)m.logSeverityLevel=2;else if(typeof l.logSeverityLevel!="number"||!Number.isInteger(l.logSeverityLevel)||l.logSeverityLevel<0||l.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${l.logSeverityLevel}`);if((l==null?void 0:l.logVerbosityLevel)===void 0)m.logVerbosityLevel=0;else if(typeof l.logVerbosityLevel!="number"||!Number.isInteger(l.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${l.logVerbosityLevel}`);if((l==null?void 0:l.enableProfiling)===void 0&&(m.enableProfiling=!1),d=u._OrtCreateSessionOptions(s,!!m.enableCpuMemArena,!!m.enableMemPattern,o,!!m.enableProfiling,0,c,m.logSeverityLevel,m.logVerbosityLevel),d===0)throw new Error("Can't create session options");return l!=null&&l.executionProviders&&((v,y,_)=>{for(const b of y){let x=typeof b=="string"?b:b.name;switch(x){case"xnnpack":x="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${x}`)}const w=(0,i.allocWasmString)(x,_);if((0,a.getInstance)()._OrtAppendExecutionProvider(v,w)!==0)throw new Error(`Can't append execution provider: ${x}`)}})(d,l.executionProviders,f),(l==null?void 0:l.extra)!==void 0&&(0,n.iterateExtraOptions)(l.extra,"",new WeakSet,(v,y)=>{const _=(0,i.allocWasmString)(v,f),b=(0,i.allocWasmString)(y,f);if(u._OrtAddSessionConfigEntry(d,_,b)!==0)throw new Error(`Can't set a session config entry: ${v} - ${y}`)}),[d,f]}catch(s){throw d!==0&&u._OrtReleaseSessionOptions(d),f.forEach(u._free),s}}},4983:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const n=t(6361);e.allocWasmString=(i,a)=>{const l=(0,n.getInstance)(),u=l.lengthBytesUTF8(i)+1,d=l._malloc(u);return l.stringToUTF8(i,d,u),a.push(d),d}},349:(r,e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const n=t(586),i=t(4919),a=t(4983),l=t(6361);e.initOrt=(s,o)=>{const c=(0,l.getInstance)()._OrtInit(s,o);if(c!==0)throw new Error(`Can't initialize onnxruntime. error code = ${c}`)};const u=new Map;e.createSessionAllocate=s=>{const o=(0,l.getInstance)(),c=o._malloc(s.byteLength);return o.HEAPU8.set(s,c),[c,s.byteLength]},e.createSessionFinalize=(s,o)=>{const c=(0,l.getInstance)();let v=0,y=0,_=[];try{if([y,_]=(0,i.setSessionOptions)(o),v=c._OrtCreateSession(s[0],s[1],y),v===0)throw new Error("Can't create a session")}finally{c._free(s[0]),c._OrtReleaseSessionOptions(y),_.forEach(c._free)}const b=c._OrtGetInputCount(v),x=c._OrtGetOutputCount(v),w=[],S=[],T=[],E=[];for(let M=0;M{const c=(0,e.createSessionAllocate)(s);return(0,e.createSessionFinalize)(c,o)},e.releaseSession=s=>{const o=(0,l.getInstance)(),c=u.get(s);if(!c)throw new Error("invalid session id");const v=c[0],y=c[1],_=c[2];y.forEach(o._OrtFree),_.forEach(o._OrtFree),o._OrtReleaseSession(v),u.delete(s)};const d=s=>{switch(s){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${s}`)}},f=s=>{switch(s){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${s}`)}},m=s=>{switch(s){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${s}`)}};e.run=(s,o,c,v,y)=>{const _=(0,l.getInstance)(),b=u.get(s);if(!b)throw new Error("invalid session id");const x=b[0],w=b[1],S=b[2],T=o.length,E=v.length;let M=0,P=[];const A=[],C=[];try{[M,P]=(0,n.setRunOptions)(y);for(let L=0;L_.HEAP32[_e++]=We);const fe=_._OrtCreateTensor(d(U),B,X,z,H.length);if(fe===0)throw new Error("Can't create a tensor");A.push(fe)}finally{_.stackRestore(Z)}}const D=_.stackSave(),k=_.stackAlloc(4*T),j=_.stackAlloc(4*T),I=_.stackAlloc(4*E),W=_.stackAlloc(4*E);try{let L=k/4,U=j/4,H=I/4,Y=W/4;for(let Z=0;ZF*ge);if(We=f(G),We==="string"){const F=[];let ge=ft/4;for(let le=0;le{const o=(0,l.getInstance)(),c=u.get(s);if(!c)throw new Error("invalid session id");const v=c[0],y=o._OrtEndProfiling(v);if(y===0)throw new Error("Can't get an profile file name");o._OrtFree(y)},e.extractTransferableBuffers=s=>{const o=[];for(const c of s){const v=c[2];!Array.isArray(v)&&v.buffer&&o.push(v.buffer)}return o}},6361:function(r,e,t){var n=this&&this.__createBinding||(Object.create?function(y,_,b,x){x===void 0&&(x=b);var w=Object.getOwnPropertyDescriptor(_,b);w&&!("get"in w?!_.__esModule:w.writable||w.configurable)||(w={enumerable:!0,get:function(){return _[b]}}),Object.defineProperty(y,x,w)}:function(y,_,b,x){x===void 0&&(x=b),y[x]=_[b]}),i=this&&this.__setModuleDefault||(Object.create?function(y,_){Object.defineProperty(y,"default",{enumerable:!0,value:_})}:function(y,_){y.default=_}),a=this&&this.__importStar||function(y){if(y&&y.__esModule)return y;var _={};if(y!=null)for(var b in y)b!=="default"&&Object.prototype.hasOwnProperty.call(y,b)&&n(_,y,b);return i(_,y),_},l=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=a(t(6449)),d=l(t(932)),f=t(3474);let m,s=!1,o=!1,c=!1;const v=(y,_)=>_?y?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":y?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async y=>{if(s)return Promise.resolve();if(o)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(c)throw new Error("previous call to 'initializeWebAssembly()' failed.");o=!0;const _=y.initTimeout,b=y.numThreads,x=y.simd,w=b>1&&(()=>{try{return typeof SharedArrayBuffer<"u"&&(typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch{return!1}})(),S=x&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}})(),T=typeof y.wasmPaths=="string"?y.wasmPaths:void 0,E=v(!1,w),M=v(S,w),P=typeof y.wasmPaths=="object"?y.wasmPaths[M]:void 0;let A=!1;const C=[];if(_>0&&C.push(new Promise(D=>{setTimeout(()=>{A=!0,D()},_)})),C.push(new Promise((D,k)=>{const j=w?f:d.default,I={locateFile:(W,L)=>w&&W.endsWith(".worker.js")&&typeof Blob<"u"?URL.createObjectURL(new Blob([t(4154)],{type:"text/javascript"})):W===E?P??(T??L)+M:L+W};if(w)if(typeof Blob>"u")I.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const W=`var ortWasmThreaded=(function(){var _scriptDir;return ${j.toString()}})();`;I.mainScriptUrlOrBlob=new Blob([W],{type:"text/javascript"})}j(I).then(W=>{o=!1,s=!0,m=W,D()},W=>{o=!1,c=!0,k(W)})})),await Promise.race(C),A)throw new Error(`WebAssembly backend initializing failed due to timeout: ${_}ms`)},e.getInstance=()=>{if(s&&m)return m;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var y;!s||o||c||(o=!0,(y=m.PThread)===null||y===void 0||y.terminateAllThreads(),m=void 0,o=!1,s=!1,c=!0)}},9710:(r,e,t)=>{t.d(e,{Z:()=>a});var n=t(477),i=t.n(n);function a(){return i()('/*!\n* ONNX Runtime Web v1.14.0\n* Copyright (c) Microsoft Corporation. All rights reserved.\n* Licensed under the MIT License.\n*/\n(()=>{var t={474:(t,e,n)=>{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){function e(){return j.buffer!=D&&N(j.buffer),P}function r(){return j.buffer!=D&&N(j.buffer),U}function a(){return j.buffer!=D&&N(j.buffer),F}function i(){return j.buffer!=D&&N(j.buffer),I}function o(){return j.buffer!=D&&N(j.buffer),W}var u,c,s;t=t||{},u||(u=void 0!==t?t:{}),u.ready=new Promise((function(t,e){c=t,s=e}));var l,f,p,h,d,y,b=Object.assign({},u),m="./this.program",g=(t,e)=>{throw e},v="object"==typeof window,w="function"==typeof importScripts,_="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,O=u.ENVIRONMENT_IS_PTHREAD||!1,A="";function S(t){return u.locateFile?u.locateFile(t,A):A+t}if(_){let e;A=w?n(908).dirname(A)+"/":"//",y=()=>{d||(h=n(384),d=n(908))},l=function(t,e){return y(),t=d.normalize(t),h.readFileSync(t,e?void 0:"utf8")},p=t=>((t=l(t,!0)).buffer||(t=new Uint8Array(t)),t),f=(t,e,n)=>{y(),t=d.normalize(t),h.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(Q())throw process.exitCode=t,e;e instanceof ct||x("exiting due to exception: "+e),process.exit(t)},u.inspect=function(){return"[Emscripten Module object]"};try{e=n(925)}catch(t){throw console.error(\'The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?\'),t}n.g.Worker=e.Worker}else(v||w)&&(w?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),_scriptDir&&(A=_scriptDir),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",_||(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},w&&(p=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)}));_&&"undefined"==typeof performance&&(n.g.performance=n(953).performance);var T=console.log.bind(console),E=console.warn.bind(console);_&&(y(),T=t=>h.writeSync(1,t+"\\n"),E=t=>h.writeSync(2,t+"\\n"));var M,C=u.print||T,x=u.printErr||E;Object.assign(u,b),b=null,u.thisProgram&&(m=u.thisProgram),u.quit&&(g=u.quit),u.wasmBinary&&(M=u.wasmBinary);var R=u.noExitRuntime||!1;"object"!=typeof WebAssembly&&at("no native wasm support detected");var j,k,D,P,U,F,I,W,H=!1,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function z(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function Y(t,e){return(t>>>=0)?z(r(),t,e):""}function B(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function G(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function N(t){D=t,u.HEAP8=P=new Int8Array(t),u.HEAP16=new Int16Array(t),u.HEAP32=F=new Int32Array(t),u.HEAPU8=U=new Uint8Array(t),u.HEAPU16=new Uint16Array(t),u.HEAPU32=I=new Uint32Array(t),u.HEAPF32=new Float32Array(t),u.HEAPF64=W=new Float64Array(t)}O&&(D=u.buffer);var V=u.INITIAL_MEMORY||16777216;if(O)j=u.wasmMemory,D=u.buffer;else if(u.wasmMemory)j=u.wasmMemory;else if(!((j=new WebAssembly.Memory({initial:V/65536,maximum:65536,shared:!0})).buffer instanceof SharedArrayBuffer))throw x("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_&&console.log("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");j&&(D=j.buffer),V=D.byteLength,N(D);var $,q=[],X=[],J=[],Z=[];function Q(){return R||!1}function K(){var t=u.preRun.shift();q.unshift(t)}var tt,et=0,nt=null,rt=null;function at(t){throw O?postMessage({cmd:"onAbort",arg:t}):u.onAbort&&u.onAbort(t),x(t="Aborted("+t+")"),H=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),s(t),t}function it(){return tt.startsWith("data:application/octet-stream;base64,")}function ot(){var t=tt;try{if(t==tt&&M)return new Uint8Array(M);if(p)return p(t);throw"both async and sync fetching of the wasm failed"}catch(t){at(t)}}tt="ort-wasm-threaded.wasm",it()||(tt=S(tt));var ut={};function ct(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function st(t){(t=ht.Vb[t])||at(),ht.mc(t)}function lt(t){var e=ht.Cc();if(!e)return 6;ht.ac.push(e),ht.Vb[t.Ub]=e,e.Ub=t.Ub;var n={cmd:"run",start_routine:t.Ic,arg:t.zc,pthread_ptr:t.Ub};return e.$b=()=>{n.time=performance.now(),e.postMessage(n,t.Nc)},e.loaded&&(e.$b(),delete e.$b),0}function ft(t){if(O)return $t(1,1,t);Q()||(ht.oc(),u.onExit&&u.onExit(t),H=!0),g(t,new ct(t))}function pt(t,e){if(!e&&O)throw bt(t),"unwind";Q()||O||(me(),dt(J),be(0),re[1].length&&ae(1,10),re[2].length&&ae(2,10),ht.oc()),ft(t)}var ht={Yb:[],ac:[],qc:[],Vb:{},fc:function(){O&&ht.Ec()},Pc:function(){},Ec:function(){ht.receiveObjectTransfer=ht.Gc,ht.threadInitTLS=ht.pc,ht.setExitStatus=ht.nc,R=!1},nc:function(){},oc:function(){for(var t of Object.values(ht.Vb))ht.mc(t);for(t of ht.Yb)t.terminate();ht.Yb=[]},mc:function(t){var e=t.Ub;delete ht.Vb[e],ht.Yb.push(t),ht.ac.splice(ht.ac.indexOf(t),1),t.Ub=0,Oe(e)},Gc:function(){},pc:function(){ht.qc.forEach((t=>t()))},Fc:function(t,e){t.onmessage=n=>{var r=(n=n.data).cmd;if(t.Ub&&(ht.Bc=t.Ub),n.targetThread&&n.targetThread!=he()){var a=ht.Vb[n.Qc];a?a.postMessage(n,n.transferList):x(\'Internal error! Worker sent a message "\'+r+\'" to target pthread \'+n.targetThread+", but that thread no longer exists!")}else"processProxyingQueue"===r?zt(n.queue):"spawnThread"===r?lt(n):"cleanupThread"===r?st(n.thread):"killThread"===r?(n=n.thread,r=ht.Vb[n],delete ht.Vb[n],r.terminate(),Oe(n),ht.ac.splice(ht.ac.indexOf(r),1),r.Ub=0):"cancelThread"===r?ht.Vb[n.thread].postMessage({cmd:"cancel"}):"loaded"===r?(t.loaded=!0,e&&e(t),t.$b&&(t.$b(),delete t.$b)):"print"===r?C("Thread "+n.threadId+": "+n.text):"printErr"===r?x("Thread "+n.threadId+": "+n.text):"alert"===r?alert("Thread "+n.threadId+": "+n.text):"setimmediate"===n.target?t.postMessage(n):"onAbort"===r?u.onAbort&&u.onAbort(n.arg):r&&x("worker sent an unknown command "+r);ht.Bc=void 0},t.onerror=t=>{throw x("worker sent an error! "+t.filename+":"+t.lineno+": "+t.message),t},_&&(t.on("message",(function(e){t.onmessage({data:e})})),t.on("error",(function(e){t.onerror(e)})),t.on("detachedExit",(function(){}))),t.postMessage({cmd:"load",urlOrBlob:u.mainScriptUrlOrBlob||_scriptDir,wasmMemory:j,wasmModule:k})},yc:function(){var t=S("ort-wasm-threaded.worker.js");ht.Yb.push(new Worker(t))},Cc:function(){return 0==ht.Yb.length&&(ht.yc(),ht.Fc(ht.Yb[0])),ht.Yb.pop()}};function dt(t){for(;0>2>>>0];t=a()[t+48>>2>>>0],Te(e,e-t),Me(e)};var mt=[];function gt(t){var e=mt[t];return e||(t>=mt.length&&(mt.length=t+1),mt[t]=e=$.get(t)),e}u.invokeEntryPoint=function(t,e){t=gt(t)(e),Q()?ht.nc(t):Ae(t)};var vt,wt,_t=[],Ot=0,At=0;function St(t){this.Zb=t,this.Sb=t-24,this.xc=function(t){i()[this.Sb+4>>2>>>0]=t},this.bc=function(){return i()[this.Sb+4>>2>>>0]},this.wc=function(t){i()[this.Sb+8>>2>>>0]=t},this.Dc=function(){return i()[this.Sb+8>>2>>>0]},this.rc=function(){a()[this.Sb>>2>>>0]=0},this.hc=function(t){t=t?1:0,e()[this.Sb+12>>0>>>0]=t},this.uc=function(){return 0!=e()[this.Sb+12>>0>>>0]},this.ic=function(t){t=t?1:0,e()[this.Sb+13>>0>>>0]=t},this.kc=function(){return 0!=e()[this.Sb+13>>0>>>0]},this.fc=function(t,e){this.cc(0),this.xc(t),this.wc(e),this.rc(),this.hc(!1),this.ic(!1)},this.sc=function(){Atomics.add(a(),this.Sb>>2,1)},this.Hc=function(){return 1===Atomics.sub(a(),this.Sb>>2,1)},this.cc=function(t){i()[this.Sb+16>>2>>>0]=t},this.tc=function(){return i()[this.Sb+16>>2>>>0]},this.vc=function(){if(Re(this.bc()))return i()[this.Zb>>2>>>0];var t=this.tc();return 0!==t?t:this.Zb}}function Tt(t){return ye(new St(t).Sb)}function Et(t,e,n,r){return O?$t(3,1,t,e,n,r):Mt(t,e,n,r)}function Mt(t,e,n,r){if("undefined"==typeof SharedArrayBuffer)return x("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var a=[];return O&&0===a.length?Et(t,e,n,r):(t={Ic:n,Ub:t,zc:r,Nc:a},O?(t.Oc="spawnThread",postMessage(t,a),0):lt(t))}function Ct(t,e,n){return O?$t(4,1,t,e,n):0}function xt(t,e){if(O)return $t(5,1,t,e)}function Rt(t,e){if(O)return $t(6,1,t,e)}function jt(t,e,n){if(O)return $t(7,1,t,e,n)}function kt(t,e,n){return O?$t(8,1,t,e,n):0}function Dt(t,e){if(O)return $t(9,1,t,e)}function Pt(t,e,n){if(O)return $t(10,1,t,e,n)}function Ut(t,e,n,r){if(O)return $t(11,1,t,e,n,r)}function Ft(t,e,n,r){if(O)return $t(12,1,t,e,n,r)}function It(t,e,n,r){if(O)return $t(13,1,t,e,n,r)}function Wt(t){if(O)return $t(14,1,t)}function Ht(t,e){if(O)return $t(15,1,t,e)}function Lt(t,e,n){if(O)return $t(16,1,t,e,n)}function zt(t){Atomics.store(a(),t>>2,1),he()&&_e(t),Atomics.compareExchange(a(),t>>2,1,0)}function Yt(t){return i()[t>>>2]+4294967296*a()[t+4>>>2]}function Bt(t,e,n,r,a,i){return O?$t(17,1,t,e,n,r,a,i):-52}function Gt(t,e,n,r,a,i){if(O)return $t(18,1,t,e,n,r,a,i)}function Nt(t){var n=G(t)+1,r=de(n);return r&&B(t,e(),r,n),r}function Vt(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}if(O)return $t(19,1,t,e,n);var o=(new Date).getFullYear(),u=new Date(o,0,1),c=new Date(o,6,1);o=u.getTimezoneOffset();var s=c.getTimezoneOffset(),l=Math.max(o,s);a()[t>>2>>>0]=60*l,a()[e>>2>>>0]=Number(o!=s),t=r(u),e=r(c),t=Nt(t),e=Nt(e),s>2>>>0]=t,i()[n+4>>2>>>0]=e):(i()[n>>2>>>0]=e,i()[n+4>>2>>>0]=t)}function $t(t,e){var n=arguments.length-2,r=arguments;return yt((()=>{for(var a=Ce(8*n),i=a>>3,u=0;u>>0]=c}return we(t,n,a,e)}))}u.executeNotifiedProxyingQueue=zt,wt=_?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:O?()=>performance.now()-u.__performance_now_clock_drift:()=>performance.now();var qt,Xt=[],Jt={};function Zt(){if(!qt){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:m||"./this.program"};for(t in Jt)void 0===Jt[t]?delete e[t]:e[t]=Jt[t];var n=[];for(t in e)n.push(t+"="+e[t]);qt=n}return qt}function Qt(t,n){if(O)return $t(20,1,t,n);var r=0;return Zt().forEach((function(a,o){var u=n+r;for(o=i()[t+4*o>>2>>>0]=u,u=0;u>0>>>0]=a.charCodeAt(u);e()[o>>0>>>0]=0,r+=a.length+1})),0}function Kt(t,e){if(O)return $t(21,1,t,e);var n=Zt();i()[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),i()[e>>2>>>0]=r,0}function te(t){return O?$t(22,1,t):52}function ee(t,e,n,r){return O?$t(23,1,t,e,n,r):52}function ne(t,e,n,r,a){return O?$t(24,1,t,e,n,r,a):70}var re=[null,[],[]];function ae(t,e){var n=re[t];0===e||10===e?((1===t?C:x)(z(n,0)),n.length=0):n.push(e)}function ie(t,e,n,a){if(O)return $t(25,1,t,e,n,a);for(var o=0,u=0;u>2>>>0],s=i()[e+4>>2>>>0];e+=8;for(var l=0;l>>0]);o+=s}return i()[a>>2>>>0]=o,0}var oe=0;function ue(t){return 0==t%4&&(0!=t%100||0==t%400)}var ce=[31,29,31,30,31,30,31,31,30,31,30,31],se=[31,28,31,30,31,30,31,31,30,31,30,31];function le(t,n,r,i){function o(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=s(new Date(t.getFullYear(),0,4)),n=s(n),0>=c(e,t)?0>=c(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var f=a()[i+40>>2>>>0];for(var p in i={Lc:a()[i>>2>>>0],Kc:a()[i+4>>2>>>0],dc:a()[i+8>>2>>>0],jc:a()[i+12>>2>>>0],ec:a()[i+16>>2>>>0],Xb:a()[i+20>>2>>>0],Tb:a()[i+24>>2>>>0],Wb:a()[i+28>>2>>>0],Rc:a()[i+32>>2>>>0],Jc:a()[i+36>>2>>>0],Mc:f?Y(f):""},r=Y(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})r=r.replace(new RegExp(p,"g"),f[p]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(p in f={"%a":function(t){return h[t.Tb].substring(0,3)},"%A":function(t){return h[t.Tb]},"%b":function(t){return d[t.ec].substring(0,3)},"%B":function(t){return d[t.ec]},"%C":function(t){return u((t.Xb+1900)/100|0,2)},"%d":function(t){return u(t.jc,2)},"%e":function(t){return o(t.jc,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return u(t.dc,2)},"%I":function(t){return 0==(t=t.dc)?t=12:12t.dc?"AM":"PM"},"%S":function(t){return u(t.Lc,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Tb||7},"%U":function(t){return u(Math.floor((t.Wb+7-t.Tb)/7),2)},"%V":function(t){var e=Math.floor((t.Wb+7-(t.Tb+6)%7)/7);if(2>=(t.Tb+371-t.Wb-2)%7&&e++,e)53==e&&(4==(n=(t.Tb+371-t.Wb)%7)||3==n&&ue(t.Xb)||(e=1));else{e=52;var n=(t.Tb+7-t.Wb-1)%7;(4==n||5==n&&ue(t.Xb%400-1))&&e++}return u(e,2)},"%w":function(t){return t.Tb},"%W":function(t){return u(Math.floor((t.Wb+7-(t.Tb+6)%7)/7),2)},"%y":function(t){return(t.Xb+1900).toString().substring(2)},"%Y":function(t){return t.Xb+1900},"%z":function(t){var e=0<=(t=t.Jc);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.Mc},"%%":function(){return"%"}},r=r.replace(/%%/g,"\\0\\0"),f)r.includes(p)&&(r=r.replace(new RegExp(p,"g"),f[p](i)));return p=function(t){var e=Array(G(t)+1);return B(t,e,0,e.length),e}(r=r.replace(/\\0\\0/g,"%")),p.length>n?0:(function(t,n){e().set(t,n>>>0)}(p,t),p.length-1)}ht.fc();var fe=[null,ft,bt,Et,Ct,xt,Rt,jt,kt,Dt,Pt,Ut,Ft,It,Wt,Ht,Lt,Bt,Gt,Vt,Qt,Kt,te,ee,ne,ie],pe={b:function(t){return de(t+24)+24},n:function(t){return(t=new St(t)).uc()||(t.hc(!0),Ot--),t.ic(!1),_t.push(t),t.sc(),t.vc()},ma:function(t){throw x("Unexpected exception thrown, this is not properly supported - aborting"),H=!0,t},x:function(){Se(0);var t=_t.pop();if(t.Hc()&&!t.kc()){var e=t.Dc();e&>(e)(t.Zb),Tt(t.Zb)}At=0},e:function(){var t=At;if(!t)return oe=0;var e=new St(t);e.cc(t);var n=e.bc();if(!n)return oe=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;azt(r)));else if(O)postMessage({targetThread:t,cmd:"processProxyingQueue",queue:r});else{if(!(t=ht.Vb[t]))return;t.postMessage({cmd:"processProxyingQueue",queue:r})}return 1},Ea:function(){return-1},Pa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getUTCSeconds(),a()[e+4>>2>>>0]=t.getUTCMinutes(),a()[e+8>>2>>>0]=t.getUTCHours(),a()[e+12>>2>>>0]=t.getUTCDate(),a()[e+16>>2>>>0]=t.getUTCMonth(),a()[e+20>>2>>>0]=t.getUTCFullYear()-1900,a()[e+24>>2>>>0]=t.getUTCDay(),t=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,a()[e+28>>2>>>0]=t},Qa:function(t,e){t=new Date(1e3*Yt(t)),a()[e>>2>>>0]=t.getSeconds(),a()[e+4>>2>>>0]=t.getMinutes(),a()[e+8>>2>>>0]=t.getHours(),a()[e+12>>2>>>0]=t.getDate(),a()[e+16>>2>>>0]=t.getMonth(),a()[e+20>>2>>>0]=t.getFullYear()-1900,a()[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1),r=(t.getTime()-n.getTime())/864e5|0;a()[e+28>>2>>>0]=r,a()[e+36>>2>>>0]=-60*t.getTimezoneOffset(),r=new Date(t.getFullYear(),6,1).getTimezoneOffset(),t=0|(r!=(n=n.getTimezoneOffset())&&t.getTimezoneOffset()==Math.min(n,r)),a()[e+32>>2>>>0]=t},Ra:function(t){var e=new Date(a()[t+20>>2>>>0]+1900,a()[t+16>>2>>>0],a()[t+12>>2>>>0],a()[t+8>>2>>>0],a()[t+4>>2>>>0],a()[t>>2>>>0],0),n=a()[t+32>>2>>>0],r=e.getTimezoneOffset(),i=new Date(e.getFullYear(),0,1),o=new Date(e.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),c=Math.min(u,o);return 0>n?a()[t+32>>2>>>0]=Number(o!=u&&c==r):0>2>>>0]=e.getDay(),n=(e.getTime()-i.getTime())/864e5|0,a()[t+28>>2>>>0]=n,a()[t>>2>>>0]=e.getSeconds(),a()[t+4>>2>>>0]=e.getMinutes(),a()[t+8>>2>>>0]=e.getHours(),a()[t+12>>2>>>0]=e.getDate(),a()[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},Aa:Bt,Ba:Gt,Sa:function t(e,n,r){t.Ac||(t.Ac=!0,Vt(e,n,r))},y:function(){at("")},U:function(){if(!_&&!w){var t="Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread";vt||(vt={}),vt[t]||(vt[t]=1,_&&(t="warning: "+t),x(t))}},ra:function(){return 4294901760},B:wt,Ia:function(t,e,n){r().copyWithin(t>>>0,e>>>0,e+n>>>0)},F:function(){return _?n(993).cpus().length:navigator.hardwareConcurrency},Da:function(t,e,n){Xt.length=e,n>>=3;for(var r=0;r>>0];return(0>t?ut[-t-1]:fe[t]).apply(null,Xt)},qa:function(t){var e=r().length;if((t>>>=0)<=e||4294901760=n;n*=2){var a=e*(1+.2/n);a=Math.min(a,t+100663296);var i=Math;a=Math.max(t,a),i=i.min.call(i,4294901760,a+(65536-a%65536)%65536);t:{try{j.grow(i-D.byteLength+65535>>>16),N(j.buffer);var o=1;break t}catch(t){}o=void 0}if(o)return!0}return!1},Na:function(){throw"unwind"},Ga:Qt,Ha:Kt,J:pt,I:te,S:ee,ga:ne,R:ie,d:function(){return oe},na:function t(r,a){t.lc||(t.lc=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(_)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>at("randomDevice")}());for(var i=0;i>0>>>0]=t.lc();return 0},ia:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ja:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},K:function(t){var e=Ee();try{return gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},f:function(t,e){var n=Ee();try{return gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},P:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},Q:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},k:function(t,e,n){var r=Ee();try{return gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},p:function(t,e,n,r){var a=Ee();try{return gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},q:function(t,e,n,r,a){var i=Ee();try{return gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},N:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},s:function(t,e,n,r,a,i){var o=Ee();try{return gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},w:function(t,e,n,r,a,i,o){var u=Ee();try{return gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},L:function(t,e,n,r,a,i,o,u){var c=Ee();try{return gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},E:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{return gt(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=Ee();try{return He(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},_:function(t,e,n,r,a,i,o){var u=Ee();try{return ke(t,e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},Z:function(t,e,n,r,a){var i=Ee();try{return Le(t,e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},ca:function(t,e,n,r){var a=Ee();try{return Ie(t,e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},$:function(t){var e=Ee();try{return je(t)}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},ba:function(t,e){var n=Ee();try{return We(t,e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},Y:function(t,e,n){var r=Ee();try{return De(t,e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},g:function(t){var e=Ee();try{gt(t)()}catch(t){if(Me(e),t!==t+0)throw t;Se(1,0)}},r:function(t,e){var n=Ee();try{gt(t)(e)}catch(t){if(Me(n),t!==t+0)throw t;Se(1,0)}},i:function(t,e,n){var r=Ee();try{gt(t)(e,n)}catch(t){if(Me(r),t!==t+0)throw t;Se(1,0)}},ha:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},m:function(t,e,n,r){var a=Ee();try{gt(t)(e,n,r)}catch(t){if(Me(a),t!==t+0)throw t;Se(1,0)}},v:function(t,e,n,r,a){var i=Ee();try{gt(t)(e,n,r,a)}catch(t){if(Me(i),t!==t+0)throw t;Se(1,0)}},u:function(t,e,n,r,a,i){var o=Ee();try{gt(t)(e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},O:function(t,e,n,r,a,i,o){var u=Ee();try{gt(t)(e,n,r,a,i,o)}catch(t){if(Me(u),t!==t+0)throw t;Se(1,0)}},A:function(t,e,n,r,a,i,o,u){var c=Ee();try{gt(t)(e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},ka:function(t,e,n,r,a,i,o,u,c){var s=Ee();try{gt(t)(e,n,r,a,i,o,u,c)}catch(t){if(Me(s),t!==t+0)throw t;Se(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l){var f=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(Me(f),t!==t+0)throw t;Se(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=Ee();try{gt(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(Me(b),t!==t+0)throw t;Se(1,0)}},fa:function(t,e,n,r,a,i,o,u){var c=Ee();try{Pe(t,e,n,r,a,i,o,u)}catch(t){if(Me(c),t!==t+0)throw t;Se(1,0)}},da:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=Ee();try{Fe(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(Me(p),t!==t+0)throw t;Se(1,0)}},ea:function(t,e,n,r,a,i){var o=Ee();try{Ue(t,e,n,r,a,i)}catch(t){if(Me(o),t!==t+0)throw t;Se(1,0)}},o:function(t){return t},a:j||u.wasmMemory,G:function(t){oe=t},la:le,z:function(t,e,n,r){return le(t,e,n,r)}};!function(){function t(t,e){u.asm=t.exports,ht.qc.push(u.asm.sb),$=u.asm.ub,X.unshift(u.asm.Va),k=e,O||(et--,u.monitorRunDependencies&&u.monitorRunDependencies(et),0==et&&(null!==nt&&(clearInterval(nt),nt=null),rt&&(t=rt,rt=null,t())))}function e(e){t(e.instance,e.module)}function n(t){return function(){if(!M&&(v||w)){if("function"==typeof fetch&&!tt.startsWith("file://"))return fetch(tt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+tt+"\'";return t.arrayBuffer()})).catch((function(){return ot()}));if(f)return new Promise((function(t,e){f(tt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ot()}))}().then((function(t){return WebAssembly.instantiate(t,r)})).then((function(t){return t})).then(t,(function(t){x("failed to asynchronously prepare wasm: "+t),at(t)}))}var r={a:pe};if(O||(et++,u.monitorRunDependencies&&u.monitorRunDependencies(et)),u.instantiateWasm)try{return u.instantiateWasm(r,t)}catch(t){return x("Module.instantiateWasm callback failed with error: "+t),!1}(M||"function"!=typeof WebAssembly.instantiateStreaming||it()||tt.startsWith("file://")||_||"function"!=typeof fetch?n(e):fetch(tt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,r).then(e,(function(t){return x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation"),n(e)}))}))).catch(s)}(),u.___wasm_call_ctors=function(){return(u.___wasm_call_ctors=u.asm.Va).apply(null,arguments)},u._OrtInit=function(){return(u._OrtInit=u.asm.Wa).apply(null,arguments)},u._OrtCreateSessionOptions=function(){return(u._OrtCreateSessionOptions=u.asm.Xa).apply(null,arguments)},u._OrtAppendExecutionProvider=function(){return(u._OrtAppendExecutionProvider=u.asm.Ya).apply(null,arguments)},u._OrtAddSessionConfigEntry=function(){return(u._OrtAddSessionConfigEntry=u.asm.Za).apply(null,arguments)},u._OrtReleaseSessionOptions=function(){return(u._OrtReleaseSessionOptions=u.asm._a).apply(null,arguments)},u._OrtCreateSession=function(){return(u._OrtCreateSession=u.asm.$a).apply(null,arguments)},u._OrtReleaseSession=function(){return(u._OrtReleaseSession=u.asm.ab).apply(null,arguments)},u._OrtGetInputCount=function(){return(u._OrtGetInputCount=u.asm.bb).apply(null,arguments)},u._OrtGetOutputCount=function(){return(u._OrtGetOutputCount=u.asm.cb).apply(null,arguments)},u._OrtGetInputName=function(){return(u._OrtGetInputName=u.asm.db).apply(null,arguments)},u._OrtGetOutputName=function(){return(u._OrtGetOutputName=u.asm.eb).apply(null,arguments)},u._OrtFree=function(){return(u._OrtFree=u.asm.fb).apply(null,arguments)},u._OrtCreateTensor=function(){return(u._OrtCreateTensor=u.asm.gb).apply(null,arguments)},u._OrtGetTensorData=function(){return(u._OrtGetTensorData=u.asm.hb).apply(null,arguments)},u._OrtReleaseTensor=function(){return(u._OrtReleaseTensor=u.asm.ib).apply(null,arguments)},u._OrtCreateRunOptions=function(){return(u._OrtCreateRunOptions=u.asm.jb).apply(null,arguments)},u._OrtAddRunConfigEntry=function(){return(u._OrtAddRunConfigEntry=u.asm.kb).apply(null,arguments)},u._OrtReleaseRunOptions=function(){return(u._OrtReleaseRunOptions=u.asm.lb).apply(null,arguments)},u._OrtRun=function(){return(u._OrtRun=u.asm.mb).apply(null,arguments)},u._OrtEndProfiling=function(){return(u._OrtEndProfiling=u.asm.nb).apply(null,arguments)};var he=u._pthread_self=function(){return(he=u._pthread_self=u.asm.ob).apply(null,arguments)},de=u._malloc=function(){return(de=u._malloc=u.asm.pb).apply(null,arguments)},ye=u._free=function(){return(ye=u._free=u.asm.qb).apply(null,arguments)},be=u._fflush=function(){return(be=u._fflush=u.asm.rb).apply(null,arguments)};u.__emscripten_tls_init=function(){return(u.__emscripten_tls_init=u.asm.sb).apply(null,arguments)};var me=u.___funcs_on_exit=function(){return(me=u.___funcs_on_exit=u.asm.tb).apply(null,arguments)},ge=u.__emscripten_thread_init=function(){return(ge=u.__emscripten_thread_init=u.asm.vb).apply(null,arguments)};u.__emscripten_thread_crashed=function(){return(u.__emscripten_thread_crashed=u.asm.wb).apply(null,arguments)};var ve,we=u._emscripten_run_in_main_runtime_thread_js=function(){return(we=u._emscripten_run_in_main_runtime_thread_js=u.asm.xb).apply(null,arguments)},_e=u.__emscripten_proxy_execute_task_queue=function(){return(_e=u.__emscripten_proxy_execute_task_queue=u.asm.yb).apply(null,arguments)},Oe=u.__emscripten_thread_free_data=function(){return(Oe=u.__emscripten_thread_free_data=u.asm.zb).apply(null,arguments)},Ae=u.__emscripten_thread_exit=function(){return(Ae=u.__emscripten_thread_exit=u.asm.Ab).apply(null,arguments)},Se=u._setThrew=function(){return(Se=u._setThrew=u.asm.Bb).apply(null,arguments)},Te=u._emscripten_stack_set_limits=function(){return(Te=u._emscripten_stack_set_limits=u.asm.Cb).apply(null,arguments)},Ee=u.stackSave=function(){return(Ee=u.stackSave=u.asm.Db).apply(null,arguments)},Me=u.stackRestore=function(){return(Me=u.stackRestore=u.asm.Eb).apply(null,arguments)},Ce=u.stackAlloc=function(){return(Ce=u.stackAlloc=u.asm.Fb).apply(null,arguments)},xe=u.___cxa_can_catch=function(){return(xe=u.___cxa_can_catch=u.asm.Gb).apply(null,arguments)},Re=u.___cxa_is_pointer_type=function(){return(Re=u.___cxa_is_pointer_type=u.asm.Hb).apply(null,arguments)},je=u.dynCall_j=function(){return(je=u.dynCall_j=u.asm.Ib).apply(null,arguments)},ke=u.dynCall_iiiiij=function(){return(ke=u.dynCall_iiiiij=u.asm.Jb).apply(null,arguments)},De=u.dynCall_jii=function(){return(De=u.dynCall_jii=u.asm.Kb).apply(null,arguments)},Pe=u.dynCall_viiiiij=function(){return(Pe=u.dynCall_viiiiij=u.asm.Lb).apply(null,arguments)},Ue=u.dynCall_vjji=function(){return(Ue=u.dynCall_vjji=u.asm.Mb).apply(null,arguments)},Fe=u.dynCall_viiijjjii=function(){return(Fe=u.dynCall_viiijjjii=u.asm.Nb).apply(null,arguments)},Ie=u.dynCall_iij=function(){return(Ie=u.dynCall_iij=u.asm.Ob).apply(null,arguments)},We=u.dynCall_ji=function(){return(We=u.dynCall_ji=u.asm.Pb).apply(null,arguments)},He=u.dynCall_iiiiiij=function(){return(He=u.dynCall_iiiiiij=u.asm.Qb).apply(null,arguments)},Le=u.dynCall_iiij=function(){return(Le=u.dynCall_iiij=u.asm.Rb).apply(null,arguments)};function ze(){function t(){if(!ve&&(ve=!0,u.calledRun=!0,!H)&&(O||dt(X),c(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),!O)){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;){var t=u.postRun.shift();Z.unshift(t)}dt(Z)}}if(!(0{var _scriptDir,r=(_scriptDir=(_scriptDir="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,r,a;t=t||{},e||(e=void 0!==t?t:{}),e.ready=new Promise((function(t,e){r=t,a=e}));var i,o,u,c,s,l,f=Object.assign({},e),p="./this.program",h=(t,e)=>{throw e},d="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";b?(m=y?n(908).dirname(m)+"/":"//",l=()=>{s||(c=n(384),s=n(908))},i=function(t,e){return l(),t=s.normalize(t),c.readFileSync(t,e?void 0:"utf8")},u=t=>((t=i(t,!0)).buffer||(t=new Uint8Array(t)),t),o=(t,e,n)=>{l(),t=s.normalize(t),c.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1{if(_||0{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),o=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var g,v=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);Object.assign(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(h=e.quit),e.wasmBinary&&(g=e.wasmBinary);var _=e.noExitRuntime||!1;"object"!=typeof WebAssembly&&V("no native wasm support detected");var O,A,S,T,E,M,C=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function R(t,e,n){var r=(e>>>=0)+n;for(n=e;t[n]&&!(n>=r);)++n;if(16(a=224==(240&a)?(15&a)<<12|i<<6|o:(7&a)<<18|i<<12|o<<6|63&t[e++])?r+=String.fromCharCode(a):(a-=65536,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else r+=String.fromCharCode(a)}return r}function j(t,e){return(t>>>=0)?R(T,t,e):""}function k(t,e,n,r){if(!(0>>=0;r=n+r-1;for(var i=0;i=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++i)),127>=o){if(n>=r)break;e[n++>>>0]=o}else{if(2047>=o){if(n+1>=r)break;e[n++>>>0]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++>>>0]=224|o>>12}else{if(n+3>=r)break;e[n++>>>0]=240|o>>18,e[n++>>>0]=128|o>>12&63}e[n++>>>0]=128|o>>6&63}e[n++>>>0]=128|63&o}}return e[n>>>0]=0,n-a}function D(t){for(var e=0,n=0;n=r?e++:2047>=r?e+=2:55296<=r&&57343>=r?(e+=4,++n):e+=3}return e}function P(){var t=O.buffer;A=t,e.HEAP8=S=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=E=new Int32Array(t),e.HEAPU8=T=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=M=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var U,F=[],I=[],W=[],H=[],L=0;function z(){var t=e.preRun.shift();F.unshift(t)}var Y,B=0,G=null,N=null;function V(t){throw e.onAbort&&e.onAbort(t),w(t="Aborted("+t+")"),C=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),a(t),t}function $(){return Y.startsWith("data:application/octet-stream;base64,")}if(Y="ort-wasm.wasm",!$()){var q=Y;Y=e.locateFile?e.locateFile(q,m):m+q}function X(){var t=Y;try{if(t==Y&&g)return new Uint8Array(g);if(u)return u(t);throw"both async and sync fetching of the wasm failed"}catch(t){V(t)}}function J(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Z(t){for(;0>2>>>0]=t},this.Eb=function(){return M[this.zb+4>>2>>>0]},this.Sb=function(t){M[this.zb+8>>2>>>0]=t},this.Wb=function(){return M[this.zb+8>>2>>>0]},this.Tb=function(){E[this.zb>>2>>>0]=0},this.Ib=function(t){S[this.zb+12>>0>>>0]=t?1:0},this.Pb=function(){return 0!=S[this.zb+12>>0>>>0]},this.Jb=function(t){S[this.zb+13>>0>>>0]=t?1:0},this.Lb=function(){return 0!=S[this.zb+13>>0>>>0]},this.Rb=function(t,e){this.Fb(0),this.Ub(t),this.Sb(e),this.Tb(),this.Ib(!1),this.Jb(!1)},this.Nb=function(){E[this.zb>>2>>>0]+=1},this.Xb=function(){var t=E[this.zb>>2>>>0];return E[this.zb>>2>>>0]=t-1,1===t},this.Fb=function(t){M[this.zb+16>>2>>>0]=t},this.Ob=function(){return M[this.zb+16>>2>>>0]},this.Qb=function(){if(Mt(this.Eb()))return M[this.Db>>2>>>0];var t=this.Ob();return 0!==t?t:this.Db}}function nt(t){return vt(new et(t).zb)}var rt=[];function at(t){var e=rt[t];return e||(t>=rt.length&&(rt.length=t+1),rt[t]=e=U.get(t)),e}function it(t){var e=D(t)+1,n=gt(e);return n&&k(t,S,n,e),n}var ot={};function ut(){if(!ct){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in ot)void 0===ot[t]?delete e[t]:e[t]=ot[t];var n=[];for(t in e)n.push(t+"="+e[t]);ct=n}return ct}var ct,st=[null,[],[]];function lt(t,e){var n=st[t];0===e||10===e?((1===t?v:w)(R(n,0)),n.length=0):n.push(e)}var ft=0;function pt(t){return 0==t%4&&(0!=t%100||0==t%400)}var ht=[31,29,31,30,31,30,31,31,30,31,30,31],dt=[31,28,31,30,31,30,31,31,30,31,30,31];function yt(t,e,n,r){function a(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.lengtht?-1:0r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return n=new Date(t.getFullYear()+1,0,4),e=u(new Date(t.getFullYear(),0,4)),n=u(n),0>=o(e,t)?0>=o(n,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var s=E[r+40>>2>>>0];for(var l in r={$b:E[r>>2>>>0],Zb:E[r+4>>2>>>0],Gb:E[r+8>>2>>>0],Kb:E[r+12>>2>>>0],Hb:E[r+16>>2>>>0],Cb:E[r+20>>2>>>0],Ab:E[r+24>>2>>>0],Bb:E[r+28>>2>>>0],bc:E[r+32>>2>>>0],Yb:E[r+36>>2>>>0],ac:s?j(s):""},n=j(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(l,"g"),s[l]);var f="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),p="January February March April May June July August September October November December".split(" ");for(l in s={"%a":function(t){return f[t.Ab].substring(0,3)},"%A":function(t){return f[t.Ab]},"%b":function(t){return p[t.Hb].substring(0,3)},"%B":function(t){return p[t.Hb]},"%C":function(t){return i((t.Cb+1900)/100|0,2)},"%d":function(t){return i(t.Kb,2)},"%e":function(t){return a(t.Kb,2," ")},"%g":function(t){return c(t).toString().substring(2)},"%G":function(t){return c(t)},"%H":function(t){return i(t.Gb,2)},"%I":function(t){return 0==(t=t.Gb)?t=12:12t.Gb?"AM":"PM"},"%S":function(t){return i(t.$b,2)},"%t":function(){return"\\t"},"%u":function(t){return t.Ab||7},"%U":function(t){return i(Math.floor((t.Bb+7-t.Ab)/7),2)},"%V":function(t){var e=Math.floor((t.Bb+7-(t.Ab+6)%7)/7);if(2>=(t.Ab+371-t.Bb-2)%7&&e++,e)53==e&&(4==(n=(t.Ab+371-t.Bb)%7)||3==n&&pt(t.Cb)||(e=1));else{e=52;var n=(t.Ab+7-t.Bb-1)%7;(4==n||5==n&&pt(t.Cb%400-1))&&e++}return i(e,2)},"%w":function(t){return t.Ab},"%W":function(t){return i(Math.floor((t.Bb+7-(t.Ab+6)%7)/7),2)},"%y":function(t){return(t.Cb+1900).toString().substring(2)},"%Y":function(t){return t.Cb+1900},"%z":function(t){var e=0<=(t=t.Yb);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.ac},"%%":function(){return"%"}},n=n.replace(/%%/g,"\\0\\0"),s)n.includes(l)&&(n=n.replace(new RegExp(l,"g"),s[l](r)));return l=function(t){var e=Array(D(t)+1);return k(t,e,0,e.length),e}(n=n.replace(/\\0\\0/g,"%")),l.length>e?0:(S.set(l,t>>>0),l.length-1)}var bt={a:function(t){return gt(t+24)+24},m:function(t){return(t=new et(t)).Pb()||(t.Ib(!0),K--),t.Jb(!1),Q.push(t),t.Nb(),t.Qb()},ia:function(t){throw w("Unexpected exception thrown, this is not properly supported - aborting"),C=!0,t},w:function(){Ot(0);var t=Q.pop();if(t.Xb()&&!t.Lb()){var e=t.Wb();e&&at(e)(t.Db),nt(t.Db)}tt=0},d:function(){var t=tt;if(!t)return ft=0;var e=new et(t);e.Fb(t);var n=e.Eb();if(!n)return ft=0,t;for(var r=Array.prototype.slice.call(arguments),a=0;a>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getUTCSeconds(),E[e+4>>2>>>0]=t.getUTCMinutes(),E[e+8>>2>>>0]=t.getUTCHours(),E[e+12>>2>>>0]=t.getUTCDate(),E[e+16>>2>>>0]=t.getUTCMonth(),E[e+20>>2>>>0]=t.getUTCFullYear()-1900,E[e+24>>2>>>0]=t.getUTCDay(),E[e+28>>2>>>0]=(t.getTime()-Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},Ea:function(t,e){t=new Date(1e3*(M[t>>>2]+4294967296*E[t+4>>>2])),E[e>>2>>>0]=t.getSeconds(),E[e+4>>2>>>0]=t.getMinutes(),E[e+8>>2>>>0]=t.getHours(),E[e+12>>2>>>0]=t.getDate(),E[e+16>>2>>>0]=t.getMonth(),E[e+20>>2>>>0]=t.getFullYear()-1900,E[e+24>>2>>>0]=t.getDay();var n=new Date(t.getFullYear(),0,1);E[e+28>>2>>>0]=(t.getTime()-n.getTime())/864e5|0,E[e+36>>2>>>0]=-60*t.getTimezoneOffset();var r=new Date(t.getFullYear(),6,1).getTimezoneOffset();n=n.getTimezoneOffset(),E[e+32>>2>>>0]=0|(r!=n&&t.getTimezoneOffset()==Math.min(n,r))},Fa:function(t){var e=new Date(E[t+20>>2>>>0]+1900,E[t+16>>2>>>0],E[t+12>>2>>>0],E[t+8>>2>>>0],E[t+4>>2>>>0],E[t>>2>>>0],0),n=E[t+32>>2>>>0],r=e.getTimezoneOffset(),a=new Date(e.getFullYear(),0,1),i=new Date(e.getFullYear(),6,1).getTimezoneOffset(),o=a.getTimezoneOffset(),u=Math.min(o,i);return 0>n?E[t+32>>2>>>0]=Number(i!=o&&u==r):0>2>>>0]=e.getDay(),E[t+28>>2>>>0]=(e.getTime()-a.getTime())/864e5|0,E[t>>2>>>0]=e.getSeconds(),E[t+4>>2>>>0]=e.getMinutes(),E[t+8>>2>>>0]=e.getHours(),E[t+12>>2>>>0]=e.getDate(),E[t+16>>2>>>0]=e.getMonth(),e.getTime()/1e3|0},sa:function(){return-52},ta:function(){},Ga:function t(e,n,r){t.Vb||(t.Vb=!0,function(t,e,n){function r(t){return(t=t.toTimeString().match(/\\(([A-Za-z ]+)\\)$/))?t[1]:"GMT"}var a=(new Date).getFullYear(),i=new Date(a,0,1),o=new Date(a,6,1);a=i.getTimezoneOffset();var u=o.getTimezoneOffset();E[t>>2>>>0]=60*Math.max(a,u),E[e>>2>>>0]=Number(a!=u),t=r(i),e=r(o),t=it(t),e=it(e),u>2>>>0]=t,M[n+4>>2>>>0]=e):(M[n>>2>>>0]=e,M[n+4>>2>>>0]=t)}(e,n,r))},B:function(){V("")},ma:function(){return 4294901760},I:b?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now(),xa:function(t,e,n){T.copyWithin(t>>>0,e>>>0,e+n>>>0)},G:function(t){var e=T.length;if(4294901760<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296);var a=Math;r=Math.max(t,r),a=a.min.call(a,4294901760,r+(65536-r%65536)%65536);t:{try{O.grow(a-A.byteLength+65535>>>16),P();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},va:function(t,e){var n=0;return ut().forEach((function(r,a){var i=e+n;for(a=M[t+4*a>>2>>>0]=i,i=0;i>0>>>0]=r.charCodeAt(i);S[a>>0>>>0]=0,n+=r.length+1})),0},wa:function(t,e){var n=ut();M[t>>2>>>0]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),M[e>>2>>>0]=r,0},ba:function(t){_||0>2>>>0],u=M[e+4>>2>>>0];e+=8;for(var c=0;c>>0]);a+=u}return M[r>>2>>>0]=a,0},c:function(){return ft},ja:function t(e,r){t.Mb||(t.Mb=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return()=>(crypto.getRandomValues(t),t[0])}if(b)try{var e=n(Object(function(){var t=new Error("Cannot find module \'crypto\'");throw t.code="MODULE_NOT_FOUND",t}()));return()=>e.randomBytes(1)[0]}catch(t){}return()=>V("randomDevice")}());for(var a=0;a>0>>>0]=t.Mb();return 0},ea:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},fa:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},J:function(t){var e=At();try{return at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},e:function(t,e){var n=At();try{return at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},N:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},O:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},j:function(t,e,n){var r=At();try{return at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},o:function(t,e,n,r){var a=At();try{return at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},p:function(t,e,n,r,a){var i=At();try{return at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},M:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},r:function(t,e,n,r,a,i){var o=At();try{return at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},v:function(t,e,n,r,a,i,o){var u=At();try{return at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},K:function(t,e,n,r,a,i,o,u){var c=At();try{return at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},D:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{return at(t)(e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},X:function(t,e,n,r,a,i,o,u){var c=At();try{return Ft(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},V:function(t,e,n,r,a,i,o){var u=At();try{return xt(t,e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},U:function(t,e,n,r,a){var i=At();try{return It(t,e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},Z:function(t,e,n,r){var a=At();try{return Pt(t,e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},W:function(t){var e=At();try{return Ct(t)}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},Y:function(t,e){var n=At();try{return Ut(t,e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},T:function(t,e,n){var r=At();try{return Rt(t,e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},f:function(t){var e=At();try{at(t)()}catch(t){if(St(e),t!==t+0)throw t;Ot(1,0)}},q:function(t,e){var n=At();try{at(t)(e)}catch(t){if(St(n),t!==t+0)throw t;Ot(1,0)}},h:function(t,e,n){var r=At();try{at(t)(e,n)}catch(t){if(St(r),t!==t+0)throw t;Ot(1,0)}},da:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},l:function(t,e,n,r){var a=At();try{at(t)(e,n,r)}catch(t){if(St(a),t!==t+0)throw t;Ot(1,0)}},t:function(t,e,n,r,a){var i=At();try{at(t)(e,n,r,a)}catch(t){if(St(i),t!==t+0)throw t;Ot(1,0)}},u:function(t,e,n,r,a,i){var o=At();try{at(t)(e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},x:function(t,e,n,r,a,i,o){var u=At();try{at(t)(e,n,r,a,i,o)}catch(t){if(St(u),t!==t+0)throw t;Ot(1,0)}},z:function(t,e,n,r,a,i,o,u){var c=At();try{at(t)(e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},ga:function(t,e,n,r,a,i,o,u,c){var s=At();try{at(t)(e,n,r,a,i,o,u,c)}catch(t){if(St(s),t!==t+0)throw t;Ot(1,0)}},A:function(t,e,n,r,a,i,o,u,c,s,l){var f=At();try{at(t)(e,n,r,a,i,o,u,c,s,l)}catch(t){if(St(f),t!==t+0)throw t;Ot(1,0)}},C:function(t,e,n,r,a,i,o,u,c,s,l,f,p,h,d,y){var b=At();try{at(t)(e,n,r,a,i,o,u,c,s,l,f,p,h,d,y)}catch(t){if(St(b),t!==t+0)throw t;Ot(1,0)}},aa:function(t,e,n,r,a,i,o,u){var c=At();try{jt(t,e,n,r,a,i,o,u)}catch(t){if(St(c),t!==t+0)throw t;Ot(1,0)}},_:function(t,e,n,r,a,i,o,u,c,s,l,f){var p=At();try{Dt(t,e,n,r,a,i,o,u,c,s,l,f)}catch(t){if(St(p),t!==t+0)throw t;Ot(1,0)}},$:function(t,e,n,r,a,i){var o=At();try{kt(t,e,n,r,a,i)}catch(t){if(St(o),t!==t+0)throw t;Ot(1,0)}},n:function(t){return t},F:function(t){ft=t},ha:yt,y:function(t,e,n,r){return yt(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,O=e.asm.Ka,P(),U=e.asm.ib,I.unshift(e.asm.La),B--,e.monitorRunDependencies&&e.monitorRunDependencies(B),0==B&&(null!==G&&(clearInterval(G),G=null),N&&(t=N,N=null,t()))}function n(e){t(e.instance)}function r(t){return function(){if(!g&&(d||y)){if("function"==typeof fetch&&!Y.startsWith("file://"))return fetch(Y,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+Y+"\'";return t.arrayBuffer()})).catch((function(){return X()}));if(o)return new Promise((function(t,e){o(Y,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return X()}))}().then((function(t){return WebAssembly.instantiate(t,i)})).then((function(t){return t})).then(t,(function(t){w("failed to asynchronously prepare wasm: "+t),V(t)}))}var i={a:bt};if(B++,e.monitorRunDependencies&&e.monitorRunDependencies(B),e.instantiateWasm)try{return e.instantiateWasm(i,t)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}(g||"function"!=typeof WebAssembly.instantiateStreaming||$()||Y.startsWith("file://")||b||"function"!=typeof fetch?r(n):fetch(Y,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(n,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(a)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.La).apply(null,arguments)},e._OrtInit=function(){return(e._OrtInit=e.asm.Ma).apply(null,arguments)},e._OrtCreateSessionOptions=function(){return(e._OrtCreateSessionOptions=e.asm.Na).apply(null,arguments)},e._OrtAppendExecutionProvider=function(){return(e._OrtAppendExecutionProvider=e.asm.Oa).apply(null,arguments)},e._OrtAddSessionConfigEntry=function(){return(e._OrtAddSessionConfigEntry=e.asm.Pa).apply(null,arguments)},e._OrtReleaseSessionOptions=function(){return(e._OrtReleaseSessionOptions=e.asm.Qa).apply(null,arguments)},e._OrtCreateSession=function(){return(e._OrtCreateSession=e.asm.Ra).apply(null,arguments)},e._OrtReleaseSession=function(){return(e._OrtReleaseSession=e.asm.Sa).apply(null,arguments)},e._OrtGetInputCount=function(){return(e._OrtGetInputCount=e.asm.Ta).apply(null,arguments)},e._OrtGetOutputCount=function(){return(e._OrtGetOutputCount=e.asm.Ua).apply(null,arguments)},e._OrtGetInputName=function(){return(e._OrtGetInputName=e.asm.Va).apply(null,arguments)},e._OrtGetOutputName=function(){return(e._OrtGetOutputName=e.asm.Wa).apply(null,arguments)},e._OrtFree=function(){return(e._OrtFree=e.asm.Xa).apply(null,arguments)},e._OrtCreateTensor=function(){return(e._OrtCreateTensor=e.asm.Ya).apply(null,arguments)},e._OrtGetTensorData=function(){return(e._OrtGetTensorData=e.asm.Za).apply(null,arguments)},e._OrtReleaseTensor=function(){return(e._OrtReleaseTensor=e.asm._a).apply(null,arguments)},e._OrtCreateRunOptions=function(){return(e._OrtCreateRunOptions=e.asm.$a).apply(null,arguments)},e._OrtAddRunConfigEntry=function(){return(e._OrtAddRunConfigEntry=e.asm.ab).apply(null,arguments)},e._OrtReleaseRunOptions=function(){return(e._OrtReleaseRunOptions=e.asm.bb).apply(null,arguments)},e._OrtRun=function(){return(e._OrtRun=e.asm.cb).apply(null,arguments)},e._OrtEndProfiling=function(){return(e._OrtEndProfiling=e.asm.db).apply(null,arguments)};var mt,gt=e._malloc=function(){return(gt=e._malloc=e.asm.eb).apply(null,arguments)},vt=e._free=function(){return(vt=e._free=e.asm.fb).apply(null,arguments)},wt=e._fflush=function(){return(wt=e._fflush=e.asm.gb).apply(null,arguments)},_t=e.___funcs_on_exit=function(){return(_t=e.___funcs_on_exit=e.asm.hb).apply(null,arguments)},Ot=e._setThrew=function(){return(Ot=e._setThrew=e.asm.jb).apply(null,arguments)},At=e.stackSave=function(){return(At=e.stackSave=e.asm.kb).apply(null,arguments)},St=e.stackRestore=function(){return(St=e.stackRestore=e.asm.lb).apply(null,arguments)},Tt=e.stackAlloc=function(){return(Tt=e.stackAlloc=e.asm.mb).apply(null,arguments)},Et=e.___cxa_can_catch=function(){return(Et=e.___cxa_can_catch=e.asm.nb).apply(null,arguments)},Mt=e.___cxa_is_pointer_type=function(){return(Mt=e.___cxa_is_pointer_type=e.asm.ob).apply(null,arguments)},Ct=e.dynCall_j=function(){return(Ct=e.dynCall_j=e.asm.pb).apply(null,arguments)},xt=e.dynCall_iiiiij=function(){return(xt=e.dynCall_iiiiij=e.asm.qb).apply(null,arguments)},Rt=e.dynCall_jii=function(){return(Rt=e.dynCall_jii=e.asm.rb).apply(null,arguments)},jt=e.dynCall_viiiiij=function(){return(jt=e.dynCall_viiiiij=e.asm.sb).apply(null,arguments)},kt=e.dynCall_vjji=function(){return(kt=e.dynCall_vjji=e.asm.tb).apply(null,arguments)},Dt=e.dynCall_viiijjjii=function(){return(Dt=e.dynCall_viiijjjii=e.asm.ub).apply(null,arguments)},Pt=e.dynCall_iij=function(){return(Pt=e.dynCall_iij=e.asm.vb).apply(null,arguments)},Ut=e.dynCall_ji=function(){return(Ut=e.dynCall_ji=e.asm.wb).apply(null,arguments)},Ft=e.dynCall_iiiiiij=function(){return(Ft=e.dynCall_iiiiiij=e.asm.xb).apply(null,arguments)},It=e.dynCall_iiij=function(){return(It=e.dynCall_iiij=e.asm.yb).apply(null,arguments)};function Wt(){function t(){if(!mt&&(mt=!0,e.calledRun=!0,!C)){if(Z(I),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();H.unshift(t)}Z(H)}}if(!(0{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.iterateExtraOptions=void 0,e.iterateExtraOptions=(t,n,r,a)=>{if("object"==typeof t&&null!==t){if(r.has(t))throw new Error("Circular reference in options");r.add(t)}Object.entries(t).forEach((([t,i])=>{const o=n?n+t:t;if("object"==typeof i)(0,e.iterateExtraOptions)(i,o+".",r,a);else if("string"==typeof i||"number"==typeof i)a(o,i.toString());else{if("boolean"!=typeof i)throw new Error("Can\'t handle extra config type: "+typeof i);a(o,i?"1":"0")}}))}},586:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setRunOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setRunOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};try{if(void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);void 0===(null==t?void 0:t.terminate)&&(u.terminate=!1);let i=0;if(void 0!==(null==t?void 0:t.tag)&&(i=(0,a.allocWasmString)(t.tag,o)),n=e._OrtCreateRunOptions(u.logSeverityLevel,u.logVerbosityLevel,!!u.terminate,i),0===n)throw new Error("Can\'t create run options");return void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddRunConfigEntry(n,i,u))throw new Error(`Can\'t set a run config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseRunOptions(n),o.forEach(e._free),t}}},919:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setSessionOptions=void 0;const r=n(967),a=n(983),i=n(361);e.setSessionOptions=t=>{const e=(0,i.getInstance)();let n=0;const o=[],u=t||{};(t=>{t.extra||(t.extra={}),t.extra.session||(t.extra.session={});const e=t.extra.session;e.use_ort_model_bytes_directly||(e.use_ort_model_bytes_directly="1")})(u);try{void 0===(null==t?void 0:t.graphOptimizationLevel)&&(u.graphOptimizationLevel="all");const c=(t=>{switch(t){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${t}`)}})(u.graphOptimizationLevel);void 0===(null==t?void 0:t.enableCpuMemArena)&&(u.enableCpuMemArena=!0),void 0===(null==t?void 0:t.enableMemPattern)&&(u.enableMemPattern=!0),void 0===(null==t?void 0:t.executionMode)&&(u.executionMode="sequential");const s=(t=>{switch(t){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${t}`)}})(u.executionMode);let l=0;if(void 0!==(null==t?void 0:t.logId)&&(l=(0,a.allocWasmString)(t.logId,o)),void 0===(null==t?void 0:t.logSeverityLevel))u.logSeverityLevel=2;else if("number"!=typeof t.logSeverityLevel||!Number.isInteger(t.logSeverityLevel)||t.logSeverityLevel<0||t.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${t.logSeverityLevel}`);if(void 0===(null==t?void 0:t.logVerbosityLevel))u.logVerbosityLevel=0;else if("number"!=typeof t.logVerbosityLevel||!Number.isInteger(t.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${t.logVerbosityLevel}`);if(void 0===(null==t?void 0:t.enableProfiling)&&(u.enableProfiling=!1),n=e._OrtCreateSessionOptions(c,!!u.enableCpuMemArena,!!u.enableMemPattern,s,!!u.enableProfiling,0,l,u.logSeverityLevel,u.logVerbosityLevel),0===n)throw new Error("Can\'t create session options");return(null==t?void 0:t.executionProviders)&&((t,e,n)=>{for(const r of e){let e="string"==typeof r?r:r.name;switch(e){case"xnnpack":e="XNNPACK";break;case"wasm":case"cpu":continue;default:throw new Error(`not supported EP: ${e}`)}const o=(0,a.allocWasmString)(e,n);if(0!==(0,i.getInstance)()._OrtAppendExecutionProvider(t,o))throw new Error(`Can\'t append execution provider: ${e}`)}})(n,t.executionProviders,o),void 0!==(null==t?void 0:t.extra)&&(0,r.iterateExtraOptions)(t.extra,"",new WeakSet,((t,r)=>{const i=(0,a.allocWasmString)(t,o),u=(0,a.allocWasmString)(r,o);if(0!==e._OrtAddSessionConfigEntry(n,i,u))throw new Error(`Can\'t set a session config entry: ${t} - ${r}`)})),[n,o]}catch(t){throw 0!==n&&e._OrtReleaseSessionOptions(n),o.forEach(e._free),t}}},983:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.allocWasmString=void 0;const r=n(361);e.allocWasmString=(t,e)=>{const n=(0,r.getInstance)(),a=n.lengthBytesUTF8(t)+1,i=n._malloc(a);return n.stringToUTF8(t,i,a),e.push(i),i}},349:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.extractTransferableBuffers=e.endProfiling=e.run=e.releaseSession=e.createSession=e.createSessionFinalize=e.createSessionAllocate=e.initOrt=void 0;const r=n(586),a=n(919),i=n(983),o=n(361);e.initOrt=(t,e)=>{const n=(0,o.getInstance)()._OrtInit(t,e);if(0!==n)throw new Error(`Can\'t initialize onnxruntime. error code = ${n}`)};const u=new Map;e.createSessionAllocate=t=>{const e=(0,o.getInstance)(),n=e._malloc(t.byteLength);return e.HEAPU8.set(t,n),[n,t.byteLength]},e.createSessionFinalize=(t,e)=>{const n=(0,o.getInstance)();let r=0,i=0,c=[];try{if([i,c]=(0,a.setSessionOptions)(e),r=n._OrtCreateSession(t[0],t[1],i),0===r)throw new Error("Can\'t create a session")}finally{n._free(t[0]),n._OrtReleaseSessionOptions(i),c.forEach(n._free)}const s=n._OrtGetInputCount(r),l=n._OrtGetOutputCount(r),f=[],p=[],h=[],d=[];for(let t=0;t{const r=(0,e.createSessionAllocate)(t);return(0,e.createSessionFinalize)(r,n)},e.releaseSession=t=>{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=n[1],i=n[2];a.forEach(e._OrtFree),i.forEach(e._OrtFree),e._OrtReleaseSession(r),u.delete(t)};const c=t=>{switch(t){case"int8":return 3;case"uint8":return 2;case"bool":return 9;case"int16":return 5;case"uint16":return 4;case"int32":return 6;case"uint32":return 12;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;default:throw new Error(`unsupported data type: ${t}`)}},s=t=>{switch(t){case 3:return"int8";case 2:return"uint8";case 9:return"bool";case 5:return"int16";case 4:return"uint16";case 6:return"int32";case 12:return"uint32";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";default:throw new Error(`unsupported data type: ${t}`)}},l=t=>{switch(t){case"float32":return Float32Array;case"uint8":case"bool":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${t}`)}};e.run=(t,e,n,a,f)=>{const p=(0,o.getInstance)(),h=u.get(t);if(!h)throw new Error("invalid session id");const d=h[0],y=h[1],b=h[2],m=e.length,g=a.length;let v=0,w=[];const _=[],O=[];try{[v,w]=(0,r.setRunOptions)(f);for(let t=0;tp.HEAP32[t++]=e));const n=p._OrtCreateTensor(c(e),o,u,l,r.length);if(0===n)throw new Error("Can\'t create a tensor");_.push(n)}finally{p.stackRestore(s)}}const t=p.stackSave(),o=p.stackAlloc(4*m),u=p.stackAlloc(4*m),h=p.stackAlloc(4*g),A=p.stackAlloc(4*g);try{let n=o/4,r=u/4,i=h/4,c=A/4;for(let t=0;tt*e));if(a=s(o),"string"===a){const t=[];let e=i/4;for(let n=0;n{const e=(0,o.getInstance)(),n=u.get(t);if(!n)throw new Error("invalid session id");const r=n[0],a=e._OrtEndProfiling(r);if(0===a)throw new Error("Can\'t get an profile file name");e._OrtFree(a)},e.extractTransferableBuffers=t=>{const e=[];for(const n of t){const t=n[2];!Array.isArray(t)&&t.buffer&&e.push(t.buffer)}return e}},361:function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(e,t,n);return a(e,t),e},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.dispose=e.getInstance=e.initializeWebAssembly=void 0;const u=i(n(449)),c=o(n(932)),s=n(474);let l,f=!1,p=!1,h=!1;const d=(t,e)=>e?t?"ort-wasm-simd-threaded.wasm":"ort-wasm-threaded.wasm":t?"ort-wasm-simd.wasm":"ort-wasm.wasm";e.initializeWebAssembly=async t=>{if(f)return Promise.resolve();if(p)throw new Error("multiple calls to \'initializeWebAssembly()\' detected.");if(h)throw new Error("previous call to \'initializeWebAssembly()\' failed.");p=!0;const e=t.initTimeout,r=t.numThreads,a=t.simd,i=r>1&&(()=>{try{return"undefined"!=typeof SharedArrayBuffer&&("undefined"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])))}catch(t){return!1}})(),o=a&&(()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch(t){return!1}})(),y="string"==typeof t.wasmPaths?t.wasmPaths:void 0,b=d(!1,i),m=d(o,i),g="object"==typeof t.wasmPaths?t.wasmPaths[m]:void 0;let v=!1;const w=[];if(e>0&&w.push(new Promise((t=>{setTimeout((()=>{v=!0,t()}),e)}))),w.push(new Promise(((t,e)=>{const r=i?s:c.default,a={locateFile:(t,e)=>i&&t.endsWith(".worker.js")&&"undefined"!=typeof Blob?URL.createObjectURL(new Blob([n(154)],{type:"text/javascript"})):t===b?null!=g?g:(null!=y?y:e)+m:e+t};if(i)if("undefined"==typeof Blob)a.mainScriptUrlOrBlob=u.join("/","ort-wasm-threaded.js");else{const t=`var ortWasmThreaded=(function(){var _scriptDir;return ${r.toString()}})();`;a.mainScriptUrlOrBlob=new Blob([t],{type:"text/javascript"})}r(a).then((e=>{p=!1,f=!0,l=e,t()}),(t=>{p=!1,h=!0,e(t)}))}))),await Promise.race(w),v)throw new Error(`WebAssembly backend initializing failed due to timeout: ${e}ms`)},e.getInstance=()=>{if(f&&l)return l;throw new Error("WebAssembly is not initialized yet.")},e.dispose=()=>{var t;!f||p||h||(p=!0,null===(t=l.PThread)||void 0===t||t.terminateAllThreads(),l=void 0,p=!1,f=!1,h=!0)}},154:t=>{"use strict";t.exports=\'"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}};\\n\'},384:()=>{},993:()=>{},908:()=>{},953:()=>{},925:()=>{},449:()=>{}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var i=e[r]={exports:{}};return t[r].call(i.exports,i,i.exports,n),i.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(()=>{"use strict";const t=n(349),e=n(361);self.onmessage=n=>{switch(n.data.type){case"init-wasm":(0,e.initializeWebAssembly)(n.data.in).then((()=>postMessage({type:"init-wasm"})),(t=>postMessage({type:"init-wasm",err:t})));break;case"init-ort":try{const{numThreads:e,loggingLevel:r}=n.data.in;(0,t.initOrt)(e,r),postMessage({type:"init-ort"})}catch(t){postMessage({type:"init-ort",err:t})}break;case"create_allocate":try{const{model:e}=n.data.in,r=(0,t.createSessionAllocate)(e);postMessage({type:"create_allocate",out:r})}catch(t){postMessage({type:"create_allocate",err:t})}break;case"create_finalize":try{const{modeldata:e,options:r}=n.data.in,a=(0,t.createSessionFinalize)(e,r);postMessage({type:"create_finalize",out:a})}catch(t){postMessage({type:"create_finalize",err:t})}break;case"create":try{const{model:e,options:r}=n.data.in,a=(0,t.createSession)(e,r);postMessage({type:"create",out:a})}catch(t){postMessage({type:"create",err:t})}break;case"release":try{const e=n.data.in;(0,t.releaseSession)(e),postMessage({type:"release"})}catch(t){postMessage({type:"release",err:t})}break;case"run":try{const{sessionId:e,inputIndices:r,inputs:a,outputIndices:i,options:o}=n.data.in,u=(0,t.run)(e,r,a,i,o);postMessage({type:"run",out:u},(0,t.extractTransferableBuffers)(u))}catch(t){postMessage({type:"run",err:t})}break;case"end-profiling":try{const e=n.data.in;(0,t.endProfiling)(e),postMessage({type:"end-profiling"})}catch(t){postMessage({type:"end-profiling",err:t})}}}})()})();\n',"Worker",void 0,void 0)}},477:r=>{r.exports=function(e,t,n,i){var a=self||window;try{try{var l;try{l=new a.Blob([e])}catch{(l=new(a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder)).append(e),l=l.getBlob()}var u=a.URL||a.webkitURL,d=u.createObjectURL(l),f=new a[t](d,n);return u.revokeObjectURL(d),f}catch{return new a[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch{if(!i)throw Error("Inline worker is not supported");return new a[t](i,n)}}},4154:r=>{r.exports=`"use strict";var e={},t="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node;if(t){var r=require("worker_threads"),a=r.parentPort;a.on("message",(e=>onmessage({data:e})));var o=require("fs");Object.assign(global,{self:global,require:require,Module:e,location:{href:__filename},Worker:r.Worker,importScripts:function(e){(0,eval)(o.readFileSync(e,"utf8"))},postMessage:function(e){a.postMessage(e)},performance:global.performance||{now:function(){return Date.now()}}})}var s=!1,n=[],i=function(){var e=Array.prototype.slice.call(arguments).join(" ");t?o.writeSync(2,e+"\\n"):console.error(e)};self.alert=function(){var t=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:t,threadId:e._pthread_self()})},e.instantiateWasm=(t,r)=>{var a=new WebAssembly.Instance(e.wasmModule,t);return r(a),e.wasmModule=null,a.exports},self.onunhandledrejection=e=>{throw e.reason??e},self.onmessage=t=>{try{if("load"===t.data.cmd){if(e.wasmModule=t.data.wasmModule,e.wasmMemory=t.data.wasmMemory,e.buffer=e.wasmMemory.buffer,e.ENVIRONMENT_IS_PTHREAD=!0,"string"==typeof t.data.urlOrBlob)importScripts(t.data.urlOrBlob);else{var r=URL.createObjectURL(t.data.urlOrBlob);importScripts(r),URL.revokeObjectURL(r)}ortWasmThreaded(e).then((function(t){e=t}))}else if("run"===t.data.cmd){e.__performance_now_clock_drift=performance.now()-t.data.time,e.__emscripten_thread_init(t.data.pthread_ptr,0,0,1),e.establishStackSpace(),e.PThread.receiveObjectTransfer(t.data),e.PThread.threadInitTLS(),s||(n.forEach((t=>{e.executeNotifiedProxyingQueue(t)})),n=[],s=!0);try{e.invokeEntryPoint(t.data.start_routine,t.data.arg)}catch(t){if("unwind"!=t){if(!(t instanceof e.ExitStatus))throw t;e.keepRuntimeAlive()||e.__emscripten_thread_exit(t.status)}}}else"cancel"===t.data.cmd?e._pthread_self()&&e.__emscripten_thread_exit(-1):"setimmediate"===t.data.target||("processProxyingQueue"===t.data.cmd?s?e.executeNotifiedProxyingQueue(t.data.queue):n.push(t.data.queue):(i("worker.js received unknown command "+t.data.cmd),i(t.data)))}catch(t){throw i("worker.js onmessage() captured an uncaught exception: "+t),t&&t.stack&&i(t.stack),e.__emscripten_thread_crashed&&e.__emscripten_thread_crashed(),t}}; -`},1670:r=>{r.exports=__WEBPACK_EXTERNAL_MODULE__1670__},7067:()=>{},1296:()=>{},1384:()=>{},3993:()=>{},908:()=>{},6953:()=>{},9925:()=>{},2806:()=>{},6449:()=>{},2850:()=>{},5381:()=>{},5686:(r,e,t)=>{t.r(e),t.d(e,{flatbuffers:()=>n});var n={};n.Offset,n.Table,n.SIZEOF_SHORT=2,n.SIZEOF_INT=4,n.FILE_IDENTIFIER_LENGTH=4,n.SIZE_PREFIX_LENGTH=4,n.Encoding={UTF8_BYTES:1,UTF16_STRING:2},n.int32=new Int32Array(2),n.float32=new Float32Array(n.int32.buffer),n.float64=new Float64Array(n.int32.buffer),n.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,n.Long=function(i,a){this.low=0|i,this.high=0|a},n.Long.create=function(i,a){return i==0&&a==0?n.Long.ZERO:new n.Long(i,a)},n.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},n.Long.prototype.equals=function(i){return this.low==i.low&&this.high==i.high},n.Long.ZERO=new n.Long(0,0),n.Builder=function(i){if(i)a=i;else var a=1024;this.bb=n.ByteBuffer.allocate(a),this.space=a,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},n.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},n.Builder.prototype.forceDefaults=function(i){this.force_defaults=i},n.Builder.prototype.dataBuffer=function(){return this.bb},n.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},n.Builder.prototype.prep=function(i,a){i>this.minalign&&(this.minalign=i);for(var l=1+~(this.bb.capacity()-this.space+a)&i-1;this.space=0&&this.vtable[a]==0;a--);for(var l=a+1;a>=0;a--)this.addInt16(this.vtable[a]!=0?i-this.vtable[a]:0);this.addInt16(i-this.object_start);var u=(l+2)*n.SIZEOF_SHORT;this.addInt16(u);var d=0,f=this.space;e:for(a=0;a=0;f--)this.writeInt8(d.charCodeAt(f))}this.prep(this.minalign,n.SIZEOF_INT+u),this.addOffset(i),u&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},n.Builder.prototype.finishSizePrefixed=function(i,a){this.finish(i,a,!0)},n.Builder.prototype.requiredField=function(i,a){var l=this.bb.capacity()-i,u=l-this.bb.readInt32(l);if(this.bb.readInt16(u+a)==0)throw new Error("FlatBuffers: field "+a+" must be set")},n.Builder.prototype.startVector=function(i,a,l){this.notNested(),this.vector_num_elems=a,this.prep(n.SIZEOF_INT,i*a),this.prep(l,i*a)},n.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},n.Builder.prototype.createString=function(i){if(i instanceof Uint8Array)var a=i;else{a=[];for(var l=0;l=56320?d:(d<<10)+i.charCodeAt(l++)+-56613888)<128?a.push(u):(u<2048?a.push(u>>6&31|192):(u<65536?a.push(u>>12&15|224):a.push(u>>18&7|240,u>>12&63|128),a.push(u>>6&63|128)),a.push(63&u|128))}}this.addInt8(0),this.startVector(1,a.length,1),this.bb.setPosition(this.space-=a.length),l=0;for(var f=this.space,m=this.bb.bytes();l>24},n.ByteBuffer.prototype.readUint8=function(i){return this.bytes_[i]},n.ByteBuffer.prototype.readInt16=function(i){return this.readUint16(i)<<16>>16},n.ByteBuffer.prototype.readUint16=function(i){return this.bytes_[i]|this.bytes_[i+1]<<8},n.ByteBuffer.prototype.readInt32=function(i){return this.bytes_[i]|this.bytes_[i+1]<<8|this.bytes_[i+2]<<16|this.bytes_[i+3]<<24},n.ByteBuffer.prototype.readUint32=function(i){return this.readInt32(i)>>>0},n.ByteBuffer.prototype.readInt64=function(i){return new n.Long(this.readInt32(i),this.readInt32(i+4))},n.ByteBuffer.prototype.readUint64=function(i){return new n.Long(this.readUint32(i),this.readUint32(i+4))},n.ByteBuffer.prototype.readFloat32=function(i){return n.int32[0]=this.readInt32(i),n.float32[0]},n.ByteBuffer.prototype.readFloat64=function(i){return n.int32[n.isLittleEndian?0:1]=this.readInt32(i),n.int32[n.isLittleEndian?1:0]=this.readInt32(i+4),n.float64[0]},n.ByteBuffer.prototype.writeInt8=function(i,a){this.bytes_[i]=a},n.ByteBuffer.prototype.writeUint8=function(i,a){this.bytes_[i]=a},n.ByteBuffer.prototype.writeInt16=function(i,a){this.bytes_[i]=a,this.bytes_[i+1]=a>>8},n.ByteBuffer.prototype.writeUint16=function(i,a){this.bytes_[i]=a,this.bytes_[i+1]=a>>8},n.ByteBuffer.prototype.writeInt32=function(i,a){this.bytes_[i]=a,this.bytes_[i+1]=a>>8,this.bytes_[i+2]=a>>16,this.bytes_[i+3]=a>>24},n.ByteBuffer.prototype.writeUint32=function(i,a){this.bytes_[i]=a,this.bytes_[i+1]=a>>8,this.bytes_[i+2]=a>>16,this.bytes_[i+3]=a>>24},n.ByteBuffer.prototype.writeInt64=function(i,a){this.writeInt32(i,a.low),this.writeInt32(i+4,a.high)},n.ByteBuffer.prototype.writeUint64=function(i,a){this.writeUint32(i,a.low),this.writeUint32(i+4,a.high)},n.ByteBuffer.prototype.writeFloat32=function(i,a){n.float32[0]=a,this.writeInt32(i,n.int32[0])},n.ByteBuffer.prototype.writeFloat64=function(i,a){n.float64[0]=a,this.writeInt32(i,n.int32[n.isLittleEndian?0:1]),this.writeInt32(i+4,n.int32[n.isLittleEndian?1:0])},n.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length>10),56320+(1023&f)))}return u},n.ByteBuffer.prototype.__indirect=function(i){return i+this.readInt32(i)},n.ByteBuffer.prototype.__vector=function(i){return i+this.readInt32(i)+n.SIZEOF_INT},n.ByteBuffer.prototype.__vector_len=function(i){return this.readInt32(i+this.readInt32(i))},n.ByteBuffer.prototype.__has_identifier=function(i){if(i.length!=n.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+n.FILE_IDENTIFIER_LENGTH);for(var a=0;a{var e=r&&r.__esModule?()=>r.default:()=>r;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(r,e)=>{for(var t in e)__webpack_require__.o(e,t)&&!__webpack_require__.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},__webpack_require__.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),__webpack_require__.o=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),__webpack_require__.r=r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(6018);return __webpack_exports__})())}(ortWeb_min)),ortWeb_min.exports}var assetPath={},hasRequiredAssetPath;function requireAssetPath(){if(hasRequiredAssetPath)return assetPath;hasRequiredAssetPath=1,Object.defineProperty(assetPath,"__esModule",{value:!0}),assetPath.baseAssetPath=void 0;const e=typeof window<"u"&&typeof window.document<"u"?window.document.currentScript:null;let t="/";return e&&(t=e.src.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),assetPath.baseAssetPath=t,assetPath}var defaultModelFetcher={},hasRequiredDefaultModelFetcher;function requireDefaultModelFetcher(){if(hasRequiredDefaultModelFetcher)return defaultModelFetcher;hasRequiredDefaultModelFetcher=1,Object.defineProperty(defaultModelFetcher,"__esModule",{value:!0}),defaultModelFetcher.defaultModelFetcher=void 0;const r=e=>fetch(e).then(t=>t.arrayBuffer());return defaultModelFetcher.defaultModelFetcher=r,defaultModelFetcher}var frameProcessor={},logging={},hasRequiredLogging;function requireLogging(){return hasRequiredLogging||(hasRequiredLogging=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.log=r.LOG_PREFIX=void 0,r.LOG_PREFIX="[VAD]";const e=["error","debug","warn"];function t(i){return(...a)=>{console[i](r.LOG_PREFIX,...a)}}const n=e.reduce((i,a)=>(i[a]=t(a),i),{});r.log=n}(logging)),logging}var messages={},hasRequiredMessages;function requireMessages(){if(hasRequiredMessages)return messages;hasRequiredMessages=1,Object.defineProperty(messages,"__esModule",{value:!0}),messages.Message=void 0;var r;return function(e){e.AudioFrame="AUDIO_FRAME",e.SpeechStart="SPEECH_START",e.VADMisfire="VAD_MISFIRE",e.SpeechEnd="SPEECH_END",e.SpeechStop="SPEECH_STOP"}(r||(messages.Message=r={})),messages}var hasRequiredFrameProcessor;function requireFrameProcessor(){if(hasRequiredFrameProcessor)return frameProcessor;hasRequiredFrameProcessor=1,Object.defineProperty(frameProcessor,"__esModule",{value:!0}),frameProcessor.FrameProcessor=frameProcessor.validateOptions=frameProcessor.defaultV5FrameProcessorOptions=frameProcessor.defaultLegacyFrameProcessorOptions=void 0;const r=requireLogging(),e=requireMessages(),t=[512,1024,1536];frameProcessor.defaultLegacyFrameProcessorOptions={positiveSpeechThreshold:.5,negativeSpeechThreshold:.5-.15,preSpeechPadFrames:1,redemptionFrames:8,frameSamples:1536,minSpeechFrames:3,submitUserSpeechOnPause:!1},frameProcessor.defaultV5FrameProcessorOptions={positiveSpeechThreshold:.5,negativeSpeechThreshold:.5-.15,preSpeechPadFrames:3,redemptionFrames:24,frameSamples:512,minSpeechFrames:9,submitUserSpeechOnPause:!1};function n(l){t.includes(l.frameSamples)||r.log.warn("You are using an unusual frame size"),(l.positiveSpeechThreshold<0||l.positiveSpeechThreshold>1)&&r.log.error("positiveSpeechThreshold should be a number between 0 and 1"),(l.negativeSpeechThreshold<0||l.negativeSpeechThreshold>l.positiveSpeechThreshold)&&r.log.error("negativeSpeechThreshold should be between 0 and positiveSpeechThreshold"),l.preSpeechPadFrames<0&&r.log.error("preSpeechPadFrames should be positive"),l.redemptionFrames<0&&r.log.error("redemptionFrames should be positive")}frameProcessor.validateOptions=n;const i=l=>{const u=l.reduce((f,m)=>(f.push(f.at(-1)+m.length),f),[0]),d=new Float32Array(u.at(-1));return l.forEach((f,m)=>{const s=u[m];d.set(f,s)}),d};class a{constructor(u,d,f){this.modelProcessFunc=u,this.modelResetFunc=d,this.options=f,this.speaking=!1,this.redemptionCounter=0,this.active=!1,this.reset=()=>{this.speaking=!1,this.audioBuffer=[],this.modelResetFunc(),this.redemptionCounter=0},this.pause=()=>(this.active=!1,this.options.submitUserSpeechOnPause?this.endSegment():(this.reset(),{})),this.resume=()=>{this.active=!0},this.endSegment=()=>{const m=this.audioBuffer;this.audioBuffer=[];const s=this.speaking;this.reset();const o=m.reduce((c,v)=>c+ +v.isSpeech,0);if(s)if(o>=this.options.minSpeechFrames){const c=i(m.map(v=>v.frame));return{msg:e.Message.SpeechEnd,audio:c}}else return{msg:e.Message.VADMisfire};return{}},this.process=async m=>{if(!this.active)return{};const s=await this.modelProcessFunc(m);if(this.audioBuffer.push({frame:m,isSpeech:s.isSpeech>=this.options.positiveSpeechThreshold}),s.isSpeech>=this.options.positiveSpeechThreshold&&this.redemptionCounter&&(this.redemptionCounter=0),s.isSpeech>=this.options.positiveSpeechThreshold&&!this.speaking)return this.speaking=!0,{probs:s,msg:e.Message.SpeechStart,frame:m};if(s.isSpeech=this.options.redemptionFrames){this.redemptionCounter=0,this.speaking=!1;const o=this.audioBuffer;if(this.audioBuffer=[],o.reduce((v,y)=>v+ +y.isSpeech,0)>=this.options.minSpeechFrames){const v=i(o.map(y=>y.frame));return{probs:s,msg:e.Message.SpeechEnd,audio:v,frame:m}}else return{probs:s,msg:e.Message.VADMisfire,frame:m}}if(!this.speaking)for(;this.audioBuffer.length>this.options.preSpeechPadFrames;)this.audioBuffer.shift();return{probs:s,frame:m}},this.audioBuffer=[],this.reset()}}return frameProcessor.FrameProcessor=a,frameProcessor}var nonRealTimeVad={},models={},common={},hasRequiredCommon;function requireCommon(){return hasRequiredCommon||(hasRequiredCommon=1,Object.defineProperty(common,"__esModule",{value:!0})),common}var legacy={},hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var r;Object.defineProperty(legacy,"__esModule",{value:!0}),legacy.SileroLegacy=void 0;const e=requireLogging();class t{constructor(i,a,l,u,d){this.ortInstance=i,this._session=a,this._h=l,this._c=u,this._sr=d,this.reset_state=()=>{const f=Array(128).fill(0);this._h=new this.ortInstance.Tensor("float32",f,[2,1,64]),this._c=new this.ortInstance.Tensor("float32",f,[2,1,64])},this.process=async f=>{var y;const s={input:new this.ortInstance.Tensor("float32",f,[1,f.length]),h:this._h,c:this._c,sr:this._sr},o=await this._session.run(s);this._h=o.hn,this._c=o.cn;const[c]=(y=o.output)==null?void 0:y.data;return{notSpeech:1-c,isSpeech:c}}}}return legacy.SileroLegacy=t,r=t,t.new=async(n,i)=>{e.log.debug("initializing vad");const a=await i(),l=await n.InferenceSession.create(a),u=new n.Tensor("int64",[16000n]),d=Array(2*64).fill(0),f=new n.Tensor("float32",d,[2,1,64]),m=new n.Tensor("float32",d,[2,1,64]);return e.log.debug("vad is initialized"),new r(n,l,f,m,u)},legacy}var v5={},hasRequiredV5;function requireV5(){if(hasRequiredV5)return v5;hasRequiredV5=1;var r;Object.defineProperty(v5,"__esModule",{value:!0}),v5.SileroV5=void 0;const e=requireLogging();function t(i){const a=Array(256).fill(0);return new i.Tensor("float32",a,[2,1,128])}class n{constructor(a,l,u,d){this._session=a,this._state=l,this._sr=u,this.ortInstance=d,this.reset_state=()=>{this._state=t(this.ortInstance)},this.process=async f=>{var y;const s={input:new this.ortInstance.Tensor("float32",f,[1,f.length]),state:this._state,sr:this._sr},o=await this._session.run(s);this._state=o.stateN;const[c]=(y=o.output)==null?void 0:y.data;return{notSpeech:1-c,isSpeech:c}}}}return v5.SileroV5=n,r=n,n.new=async(i,a)=>{e.log.debug("Loading VAD...");const l=await a(),u=await i.InferenceSession.create(l),d=new i.Tensor("int64",[16000n]),f=t(i);return e.log.debug("...finished loading VAD"),new r(u,f,d,i)},v5}var hasRequiredModels;function requireModels(){return hasRequiredModels||(hasRequiredModels=1,function(r){var e=models.__createBinding||(Object.create?function(a,l,u,d){d===void 0&&(d=u);var f=Object.getOwnPropertyDescriptor(l,u);(!f||("get"in f?!l.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return l[u]}}),Object.defineProperty(a,d,f)}:function(a,l,u,d){d===void 0&&(d=u),a[d]=l[u]}),t=models.__exportStar||function(a,l){for(var u in a)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&e(l,a,u)};Object.defineProperty(r,"__esModule",{value:!0}),r.SileroV5=r.SileroLegacy=void 0,t(requireCommon(),r);var n=requireLegacy();Object.defineProperty(r,"SileroLegacy",{enumerable:!0,get:function(){return n.SileroLegacy}});var i=requireV5();Object.defineProperty(r,"SileroV5",{enumerable:!0,get:function(){return i.SileroV5}})}(models)),models}var resampler={},hasRequiredResampler;function requireResampler(){if(hasRequiredResampler)return resampler;hasRequiredResampler=1,Object.defineProperty(resampler,"__esModule",{value:!0}),resampler.Resampler=void 0;const r=requireLogging();class e{constructor(n){this.options=n,this.process=i=>{const a=[];for(const l of i)for(this.inputBuffer.push(l);this.hasEnoughDataForFrame();){const u=this.generateOutputFrame();a.push(u)}return a},this.stream=async function*(i){for(const a of i)for(this.inputBuffer.push(a);this.hasEnoughDataForFrame();)yield this.generateOutputFrame()},n.nativeSampleRate<16e3&&r.log.error("nativeSampleRate is too low. Should have 16000 = targetSampleRate <= nativeSampleRate"),this.inputBuffer=[]}hasEnoughDataForFrame(){return this.inputBuffer.length*this.options.targetSampleRate/this.options.nativeSampleRate>=this.options.targetFrameSize}generateOutputFrame(){const n=new Float32Array(this.options.targetFrameSize);let i=0,a=0;for(;i{const m=await n.SileroLegacy.new(this.ort,this.modelFetcher);this.frameProcessor=new e.FrameProcessor(m.process,m.reset_state,{frameSamples:this.options.frameSamples,positiveSpeechThreshold:this.options.positiveSpeechThreshold,negativeSpeechThreshold:this.options.negativeSpeechThreshold,redemptionFrames:this.options.redemptionFrames,preSpeechPadFrames:this.options.preSpeechPadFrames,minSpeechFrames:this.options.minSpeechFrames,submitUserSpeechOnPause:this.options.submitUserSpeechOnPause}),this.frameProcessor.resume()},this.run=async function*(m,s){const o={nativeSampleRate:s,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples},c=new i.Resampler(o);let v=0,y=0,_=0;for await(const w of c.stream(m)){const{msg:S,audio:T}=await this.frameProcessor.process(w);switch(S){case t.Message.SpeechStart:v=_*this.options.frameSamples/16;break;case t.Message.SpeechEnd:y=(_+1)*this.options.frameSamples/16,yield{audio:T,start:v,end:y};break}_++}const{msg:b,audio:x}=this.frameProcessor.endSegment();b==t.Message.SpeechEnd&&(yield{audio:x,start:v,end:_*this.options.frameSamples/16})},(0,e.validateOptions)(f)}}r.PlatformAgnosticNonRealTimeVAD=a}(nonRealTimeVad)),nonRealTimeVad}var utils$1={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$1;hasRequiredUtils$1=1,Object.defineProperty(utils$1,"__esModule",{value:!0}),utils$1.audioFileToArray=utils$1.encodeWAV=utils$1.arrayBufferToBase64=utils$1.minFramesForTargetMS=void 0;function r(u,d,f=16e3){return Math.ceil(u*f/1e3/d)}utils$1.minFramesForTargetMS=r;function e(u){const d=new Uint8Array(u),f=d.byteLength,m=new Array(f);for(var s=0;s{f.addEventListener("loadend",v=>{const y=f.result;d.decodeAudioData(y,_=>{m=_,d.startRendering().then(b=>{console.log("Rendering completed successfully"),c()}).catch(b=>{console.error(`Rendering failed: ${b}`)})},_=>{console.log(`Error with decoding audio data: ${_}`)})}),f.readAsArrayBuffer(u)}),m===null)throw Error("some shit");let s=m,o=new Float32Array(s.length);for(let c=0;c({...b==="v5"?l.defaultV5FrameProcessorOptions:l.defaultLegacyFrameProcessorOptions,onFrameProcessed:w=>{},onVADMisfire:()=>{u.log.debug("VAD misfire")},onSpeechStart:()=>{u.log.debug("Detected speech start")},onSpeechEnd:()=>{u.log.debug("Detected speech end")},baseAssetPath:"https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/",onnxWASMBasePath:"https://cdn.jsdelivr.net/npm/onnxruntime-web@1.14.0/dist/",stream:void 0,ortConfig:void 0,model:r.DEFAULT_MODEL,workletOptions:{}});r.getDefaultRealTimeVADOptions=v;class y{static async new(x={}){const w={...(0,r.getDefaultRealTimeVADOptions)(x.model??r.DEFAULT_MODEL),...x};(0,l.validateOptions)(w);let S;w.stream===void 0?S=await navigator.mediaDevices.getUserMedia({audio:{...w.additionalAudioConstraints,channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}}):S=w.stream;const T=new AudioContext,E=new MediaStreamAudioSourceNode(T,{mediaStream:S}),M=await _.new(T,w);return M.receive(E),new y(w,T,S,M,E)}constructor(x,w,S,T,E,M=!1){this.options=x,this.audioContext=w,this.stream=S,this.audioNodeVAD=T,this.sourceNode=E,this.listening=M,this.pause=()=>{this.audioNodeVAD.pause(),this.listening=!1},this.start=()=>{this.audioNodeVAD.start(),this.listening=!0},this.destroy=()=>{this.listening&&this.pause(),this.options.stream===void 0&&this.stream.getTracks().forEach(P=>P.stop()),this.sourceNode.disconnect(),this.audioNodeVAD.destroy(),this.audioContext.close()}}}r.MicVAD=y;class _{static async new(x,w={}){const S={...(0,r.getDefaultRealTimeVADOptions)(w.model??r.DEFAULT_MODEL),...w};(0,l.validateOptions)(S),r.ort.env.wasm.wasmPaths=S.onnxWASMBasePath,S.ortConfig!==void 0&&S.ortConfig(r.ort);const T=S.model==="v5"?o:c,E=S.baseAssetPath+T,M=S.model==="v5"?f.SileroV5.new:f.SileroLegacy.new;let P;try{P=await M(r.ort,()=>(0,a.defaultModelFetcher)(E))}catch(D){throw console.error(`Encountered an error while loading model file ${E}`),D}const A=new l.FrameProcessor(P.process,P.reset_state,{frameSamples:S.frameSamples,positiveSpeechThreshold:S.positiveSpeechThreshold,negativeSpeechThreshold:S.negativeSpeechThreshold,redemptionFrames:S.redemptionFrames,preSpeechPadFrames:S.preSpeechPadFrames,minSpeechFrames:S.minSpeechFrames,submitUserSpeechOnPause:S.submitUserSpeechOnPause}),C=new _(x,S,A);return await C.setupAudioNode(),C}constructor(x,w,S){this.ctx=x,this.options=w,this.bufferIndex=0,this.pause=()=>{const T=this.frameProcessor.pause();this.handleFrameProcessorEvent(T)},this.start=()=>{this.frameProcessor.resume()},this.receive=T=>{T.connect(this.audioNode)},this.processFrame=async T=>{const E=await this.frameProcessor.process(T);this.handleFrameProcessorEvent(E)},this.handleFrameProcessorEvent=T=>{switch(T.probs!==void 0&&this.options.onFrameProcessed(T.probs,T.frame),T.msg){case d.Message.SpeechStart:this.options.onSpeechStart();break;case d.Message.VADMisfire:this.options.onVADMisfire();break;case d.Message.SpeechEnd:this.options.onSpeechEnd(T.audio);break}},this.destroy=()=>{var T;this.audioNode instanceof AudioWorkletNode&&this.audioNode.port.postMessage({message:d.Message.SpeechStop}),this.audioNode.disconnect(),(T=this.gainNode)==null||T.disconnect()},this.frameProcessor=S}async setupAudioNode(){if("audioWorklet"in this.ctx&&typeof AudioWorkletNode=="function")try{const T=this.options.baseAssetPath+s;await this.ctx.audioWorklet.addModule(T);const E=this.options.workletOptions??{};E.processorOptions={...E.processorOptions??{},frameSamples:this.options.frameSamples},this.audioNode=new AudioWorkletNode(this.ctx,"vad-helper-worklet",E),this.audioNode.port.onmessage=async M=>{var P;switch((P=M.data)==null?void 0:P.message){case d.Message.AudioFrame:let A=M.data.data;A instanceof ArrayBuffer||(A=new ArrayBuffer(M.data.data.byteLength),new Uint8Array(A).set(new Uint8Array(M.data.data)));const C=new Float32Array(A);await this.processFrame(C);break}};return}catch(T){console.log("AudioWorklet setup failed, falling back to ScriptProcessor",T)}this.resampler=new m.Resampler({nativeSampleRate:this.ctx.sampleRate,targetSampleRate:16e3,targetFrameSize:this.options.frameSamples??480});const w=4096;this.audioNode=this.ctx.createScriptProcessor(w,1,1),this.gainNode=this.ctx.createGain(),this.gainNode.gain.value=0;let S=!1;this.audioNode.onaudioprocess=async T=>{if(!S){S=!0;try{const E=T.inputBuffer.getChannelData(0);if(T.outputBuffer.getChannelData(0).fill(0),this.resampler){const P=this.resampler.process(E);for(const A of P)await this.processFrame(A)}}catch(E){console.error("Error processing audio:",E)}finally{S=!1}}},this.audioNode.connect(this.gainNode),this.gainNode.connect(this.ctx.destination)}}r.AudioNodeVAD=_}(realTimeVad)),realTimeVad}var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(r){var e=dist.__createBinding||(Object.create?function(c,v,y,_){_===void 0&&(_=y);var b=Object.getOwnPropertyDescriptor(v,y);(!b||("get"in b?!v.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return v[y]}}),Object.defineProperty(c,_,b)}:function(c,v,y,_){_===void 0&&(_=y),c[_]=v[y]}),t=dist.__setModuleDefault||(Object.create?function(c,v){Object.defineProperty(c,"default",{enumerable:!0,value:v})}:function(c,v){c.default=v}),n=dist.__importStar||function(c){if(c&&c.__esModule)return c;var v={};if(c!=null)for(var y in c)y!=="default"&&Object.prototype.hasOwnProperty.call(c,y)&&e(v,c,y);return t(v,c),v};Object.defineProperty(r,"__esModule",{value:!0}),r.NonRealTimeVAD=r.Message=r.FrameProcessor=r.getDefaultRealTimeVADOptions=r.MicVAD=r.DEFAULT_MODEL=r.AudioNodeVAD=r.utils=r.defaultNonRealTimeVADOptions=void 0;const i=n(requireOrtWeb_min()),a=requireAssetPath(),l=requireDefaultModelFetcher(),u=requireFrameProcessor();Object.defineProperty(r,"FrameProcessor",{enumerable:!0,get:function(){return u.FrameProcessor}});const d=requireMessages();Object.defineProperty(r,"Message",{enumerable:!0,get:function(){return d.Message}});const f=requireNonRealTimeVad(),m=requireUtils$1();r.defaultNonRealTimeVADOptions={modelURL:a.baseAssetPath+"silero_vad_legacy.onnx",modelFetcher:l.defaultModelFetcher};class s extends f.PlatformAgnosticNonRealTimeVAD{static async new(v={}){const{modelURL:y,modelFetcher:_}={...r.defaultNonRealTimeVADOptions,...v};return await this._new(()=>_(y),i,v)}}r.NonRealTimeVAD=s,r.utils={audioFileToArray:m.audioFileToArray,minFramesForTargetMS:m.minFramesForTargetMS,arrayBufferToBase64:m.arrayBufferToBase64,encodeWAV:m.encodeWAV};var o=requireRealTimeVad();Object.defineProperty(r,"AudioNodeVAD",{enumerable:!0,get:function(){return o.AudioNodeVAD}}),Object.defineProperty(r,"DEFAULT_MODEL",{enumerable:!0,get:function(){return o.DEFAULT_MODEL}}),Object.defineProperty(r,"MicVAD",{enumerable:!0,get:function(){return o.MicVAD}}),Object.defineProperty(r,"getDefaultRealTimeVADOptions",{enumerable:!0,get:function(){return o.getDefaultRealTimeVADOptions}})}(dist)),dist}var distExports=requireDist();function useMicVAD(r,e){const t=defu(e??{},{...distExports.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),n=ref$1(),i=usePermission("microphone");async function a(){if(n.value&&(n.value.destroy(),n.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const l=unref(r);if(!l)return;const u=await navigator.mediaDevices.getUserMedia({audio:{deviceId:l}});n.value=await distExports.MicVAD.new({...t,stream:u}),t.auto&&n.value.start()}return watch(i,a,{immediate:!0}),watch(toRef(r),a,{immediate:!0}),tryOnMounted(a),onUnmounted(()=>{n.value&&(n.value.destroy(),n.value=void 0)}),{destroy:()=>{n.value&&(n.value.destroy(),n.value=void 0)},start:()=>{n.value&&n.value.start()}}}function useWhisper(r,e){const t=defu(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:n,data:i,terminate:a}=useWebWorker(r,{type:"module"}),l=ref$1(null),u=ref$1(""),d=ref$1([]),f=ref$1(!1),m=ref$1(0),s=ref$1("");return watch(i,o=>{var c,v,y,_,b,x,w,S;switch(o.status){case"loading":l.value="loading",u.value=o.data,(c=t.onLoading)==null||c.call(t,o.data);break;case"initiate":d.value.push(o),(v=t.onInitiate)==null||v.call(t,o);break;case"progress":d.value=d.value.map(T=>T.file===o.file?{...T,...o}:T),(y=t.onProgress)==null||y.call(t,o);break;case"done":d.value=d.value.filter(T=>T.file!==o.file),(_=t.onDone)==null||_.call(t,o);break;case"ready":l.value="ready",(b=t.onReady)==null||b.call(t);break;case"start":f.value=!0,(x=t.onStart)==null||x.call(t);break;case"update":m.value=o.tps,(w=t.onUpdate)==null||w.call(t,o.tps);break;case"complete":f.value=!1,s.value=o.output[0]||"",console.debug("Whisper result:",s.value),(S=t.onComplete)==null||S.call(t,o.output[0]);break}}),onUnmounted(()=>{a()}),{transcribe:o=>n(o),status:l,loadingMessage:u,loadingProgress:d,transcribing:f,tps:m,result:s,load:()=>n({type:"load"}),terminate:a}}const WhisperWorker=""+new URL("worker--0RkW31s.js",import.meta.url).href;function calculateVolumeWithLinearNormalize(r){const e=new Uint8Array(r.frequencyBinCount);r.getByteFrequencyData(e);const t=[];for(let i=0;i<700;i+=80)t.push(e[i]);return e.map(i=>i**1.2).map(i=>i*1.2).reduce((i,a)=>i+a,0)/e.length/100}function calculateVolumeWithMinMaxNormalize(r){const e=new Uint8Array(r.frequencyBinCount);r.getByteFrequencyData(e);const t=[];for(let f=0;f<700;f+=80)t.push(e[f]);const n=e.map(f=>f**1.5),i=Math.min(...n),l=Math.max(...n)-i;let u;return l===0?u=n.map(()=>0):u=n.map(f=>(f-i)/l),u.reduce((f,m)=>f+m,0)/e.length}function calculateVolume(r,e="linear"){switch(e){case"linear":return calculateVolumeWithLinearNormalize(r);case"minmax":return calculateVolumeWithMinMaxNormalize(r)}}const useAudioContext=defineStore("AudioContext",()=>({audioContext:new AudioContext,calculateVolume})),useSpeakingStore=defineStore("SpeakingStore",()=>{const t=ref$1(0),n=ref$1(!1),i=computed(()=>n.value?(30+70*t.value)/100:30);return{mouthOpenSize:t,nowSpeaking:n,nowSpeakingAvatarBorderOpacity:i}});function peek(r,e,t){return e+t<0||e+t>=r.length-1?"":r[e+t]}function useLlmmarkerParser(r){let e="literal",t="";return{async consume(n){var i,a,l;for(let u=0;u"?(d+=peek(n,u,1),f="literal",u++):d==="<"?f="special":d===">"&&(f="literal"),e==="literal"&&f==="special"?t!==""&&(await((i=r.onLiteral)==null?void 0:i.call(r,t)),t=""):e==="special"&&f==="literal"&&t!==""&&(t+=d,await((a=r.onSpecial)==null?void 0:a.call(r,t)),t=""),e==="literal"&&f==="literal"?(await((l=r.onLiteral)==null?void 0:l.call(r,d)),t=""):e==="special"&&f==="literal"?t="":t+=d,e=f}},async end(){var n,i;t!==""&&(e==="literal"?await((n=r.onLiteral)==null?void 0:n.call(r,t)):t.endsWith("|>")&&await((i=r.onSpecial)==null?void 0:i.call(r,t)))}}}function message(r,e){return{role:"system",content:[r,EMOTION_VALUES.map(t=>`- ${t}`).join(` -`),e].join(` - -`)}}async function*asyncIteratorFromReadableStream(r,e){const t=r.getReader();try{for(;;){const{done:n,value:i}=await t.read();if(n)return;yield e(i)}}finally{t.releaseLock()}}const useChatStore=defineStore("chat",()=>{const{stream:r}=useLLM(),{t:e}=useI18n(),{openAiApiBaseURL:t,openAiApiKey:n,openAiModel:i}=storeToRefs(useSettings()),a=ref$1([]),l=ref$1([]),u=ref$1([]),d=ref$1([]),f=ref$1([]),m=ref$1([]),s=ref$1([]);function o(E){a.value.push(E)}function c(E){l.value.push(E)}function v(E){u.value.push(E)}function y(E){d.value.push(E)}function _(E){f.value.push(E)}function b(E){m.value.push(E)}function x(E){s.value.push(E)}const w=ref$1([message(e("prompt.prefix"),e("prompt.suffix"))]),S=ref$1({role:"assistant",content:""});async function T(E,M){if(!E)return;for(const W of a.value)await W(E);const{baseUrl:P=t.value,apiKey:A=n.value,model:C=i.value}=M??{};S.value={role:"assistant",content:""},w.value.push({role:"user",content:E}),w.value.push(S.value);const D=w.value.slice(0,w.value.length-1);for(const W of l.value)await W(E);for(const W of u.value)await W(E);const k=await r(P,A,C.id,D);for(const W of d.value)await W(E);let j="";const I=useLlmmarkerParser({onLiteral:async W=>{for(const L of f.value)await L(W);S.value.content+=W},onSpecial:async W=>{for(const L of m.value)await L(W)}});for await(const W of asyncIteratorFromReadableStream(k.textStream,async L=>L))j+=W,await I.consume(W);await I.end();for(const W of s.value)await W();console.debug("LLM output:",j)}return{messages:w,streamingMessage:S,send:T,onBeforeMessageComposed:o,onAfterMessageComposed:c,onBeforeSend:v,onAfterSend:y,onTokenLiteral:_,onTokenSpecial:b,onStreamEnd:x}});async function encodeWAVToBase64(r,e){const t=new ArrayBuffer(44+r.length*2),n=new DataView(t);writeString(n,0,"RIFF"),n.setUint32(4,36+r.length*2,!0),writeString(n,8,"WAVE"),writeString(n,12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,e,!0),n.setUint32(28,e*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),writeString(n,36,"data"),n.setUint32(40,r.length*2,!0),floatTo16BitPCM(n,44,r);const i=new Blob([n],{type:"audio/wav"});return new Promise((a,l)=>{const u=new FileReader;u.onload=()=>{const d=u.result.split(",")[1];a(d)},u.onerror=l,u.readAsDataURL(i)})}function writeString(r,e,t){for(let n=0;n4&&t.slice(0,4)==="data"&&valid.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(dash,camelcase);n="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!dash.test(a)){let l=a.replace(cap,kebab);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=DefinedInfo}return new i(n,e)}function kebab(r){return"-"+r.toLowerCase()}function camelcase(r){return r.charAt(1).toUpperCase()}const html$3=merge([xml,xlink,xmlns,aria,html$4],"html"),svg=merge([xml,xlink,xmlns,aria,svg$1],"svg"),own$5={}.hasOwnProperty;function zwitch(r,e){const t=e;function n(i,...a){let l=n.invalid;const u=n.handlers;if(i&&own$5.call(i,r)){const d=String(i[r]);l=own$5.call(u,d)?u[d]:n.unknown}if(l)return l.call(this,i,...a)}return n.handlers=t.handlers||{},n.invalid=t.invalid,n.unknown=t.unknown,n}const defaultSubsetRegex=/["&'<>`]/g,surrogatePairsRegex=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,controlCharactersRegex=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,regexEscapeRegex=/[|\\{}()[\]^$+*?.]/g,subsetToRegexCache=new WeakMap;function core(r,e){if(r=r.replace(e.subset?charactersToExpressionCached(e.subset):defaultSubsetRegex,n),e.subset||e.escapeOnly)return r;return r.replace(surrogatePairsRegex,t).replace(controlCharactersRegex,n);function t(i,a,l){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,l.charCodeAt(a+2),e)}function n(i,a,l){return e.format(i.charCodeAt(0),l.charCodeAt(a+1),e)}}function charactersToExpressionCached(r){let e=subsetToRegexCache.get(r);return e||(e=charactersToExpression(r),subsetToRegexCache.set(r,e)),e}function charactersToExpression(r){const e=[];let t=-1;for(;++t",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},dangerous=["cent","copy","divide","gt","lt","not","para","times"],own$4={}.hasOwnProperty,characters={};let key;for(key in characterEntitiesHtml4)own$4.call(characterEntitiesHtml4,key)&&(characters[characterEntitiesHtml4[key]]=key);const notAlphanumericRegex=/[^\dA-Za-z]/;function toNamed(r,e,t,n){const i=String.fromCharCode(r);if(own$4.call(characters,i)){const a=characters[i],l="&"+a;return t&&characterEntitiesLegacy.includes(a)&&!dangerous.includes(a)&&(!n||e&&e!==61&¬AlphanumericRegex.test(String.fromCharCode(e)))?l:l+";"}return""}function formatSmart(r,e,t){let n=toHexadecimal(r,e,t.omitOptionalSemicolons),i;if((t.useNamedReferences||t.useShortestReferences)&&(i=toNamed(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!i)&&t.useShortestReferences){const a=toDecimal(r,e,t.omitOptionalSemicolons);a.length|^->||--!>|"],commentEntitySubset=["<",">"];function comment(r,e,t,n){return n.settings.bogusComments?"":"";function i(a){return stringifyEntities(a,Object.assign({},n.settings.characterReferences,{subset:commentEntitySubset}))}}function doctype(r,e,t,n){return""}function ccount(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function stringify$1(r,e){const t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}function stringify(r){return r.join(" ").trim()}const re=/[ \t\n\f\r]/g;function whitespace(r){return typeof r=="object"?r.type==="text"?empty$1(r.value):!1:empty$1(r)}function empty$1(r){return r.replace(re,"")===""}const siblingAfter=siblings(1),siblingBefore=siblings(-1),emptyChildren$1=[];function siblings(r){return e;function e(t,n,i){const a=t?t.children:emptyChildren$1;let l=(n||0)+r,u=a[l];if(!i)for(;u&&whitespace(u);)l+=r,u=a[l];return u}}const own$3={}.hasOwnProperty;function omission(r){return e;function e(t,n,i){return own$3.call(r,t.tagName)&&r[t.tagName](t,n,i)}}const closing=omission({body:body$1,caption:headOrColgroupOrCaption,colgroup:headOrColgroupOrCaption,dd,dt,head:headOrColgroupOrCaption,html:html$2,li,optgroup,option,p,rp:rubyElement,rt:rubyElement,tbody:tbody$1,td:cells,tfoot,th:cells,thead,tr});function headOrColgroupOrCaption(r,e,t){const n=siblingAfter(t,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&whitespace(n.value.charAt(0)))}function html$2(r,e,t){const n=siblingAfter(t,e);return!n||n.type!=="comment"}function body$1(r,e,t){const n=siblingAfter(t,e);return!n||n.type!=="comment"}function p(r,e,t){const n=siblingAfter(t,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function li(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&n.tagName==="li"}function dt(r,e,t){const n=siblingAfter(t,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function dd(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function rubyElement(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function optgroup(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function option(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function thead(r,e,t){const n=siblingAfter(t,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function tbody$1(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function tfoot(r,e,t){return!siblingAfter(t,e)}function tr(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&n.tagName==="tr"}function cells(r,e,t){const n=siblingAfter(t,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const opening=omission({body,colgroup,head,html:html$1,tbody});function html$1(r){const e=siblingAfter(r,-1);return!e||e.type!=="comment"}function head(r){const e=new Set;for(const n of r.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(e.has(n.tagName))return!1;e.add(n.tagName)}const t=r.children[0];return!t||t.type==="element"}function body(r){const e=siblingAfter(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&whitespace(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function colgroup(r,e,t){const n=siblingBefore(t,e),i=siblingAfter(r,-1,!0);return t&&n&&n.type==="element"&&n.tagName==="colgroup"&&closing(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function tbody(r,e,t){const n=siblingBefore(t,e),i=siblingAfter(r,-1);return t&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&closing(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const constants={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 element$1(r,e,t,n){const i=n.schema,a=i.space==="svg"?!1:n.settings.omitOptionalTags;let l=i.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(r.tagName.toLowerCase());const u=[];let d;i.space==="html"&&r.tagName==="svg"&&(n.schema=svg);const f=serializeAttributes(n,r.properties),m=n.all(i.space==="html"&&r.tagName==="template"?r.content:r);return n.schema=i,m&&(l=!1),(f||!a||!opening(r,e,t))&&(u.push("<",r.tagName,f?" "+f:""),l&&(i.space==="svg"||n.settings.closeSelfClosing)&&(d=f.charAt(f.length-1),(!n.settings.tightSelfClosing||d==="/"||d&&d!=='"'&&d!=="'")&&u.push(" "),u.push("/")),u.push(">")),u.push(m),!l&&(!a||!closing(r,e,t))&&u.push(""),u.join("")}function serializeAttributes(r,e){const t=[];let n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const a=serializeAttribute(r,i,e[i]);a&&t.push(a)}}for(;++nccount(t,r.alternative)&&(l=r.alternative),u=l+stringifyEntities(t,Object.assign({},r.settings.characterReferences,{subset:(l==="'"?constants.single:constants.double)[i][a],attribute:!0}))+l),d+(u&&"="+u))}const textEntitySubset=["<","&"];function text$3(r,e,t,n){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:stringifyEntities(r.value,Object.assign({},n.settings.characterReferences,{subset:textEntitySubset}))}function raw(r,e,t,n){return n.settings.allowDangerousHtml?r.value:text$3(r,e,t,n)}function root$1(r,e,t,n){return n.all(r)}const handle=zwitch("type",{invalid,unknown,handlers:{comment,doctype,element:element$1,raw,root:root$1,text:text$3}});function invalid(r){throw new Error("Expected node, not `"+r+"`")}function unknown(r){const e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}const emptyCharacterReferences={},emptyChildren=[];function toHtml(r,e){const t=e,n=t.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:one$1,all:all$1,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||htmlVoidElements,characterReferences:t.characterReferences||emptyCharacterReferences,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?svg:html$3,quote:n,alternative:i}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function one$1(r,e,t){return handle(r,e,t,this)}function all$1(r){const e=[],t=r&&r.children||emptyChildren;let n=-1;for(;++ni?0:i+e:e=e>i?i:e,t=t>0?t:0,n.length<1e4)l=Array.from(n),l.unshift(e,t),r.splice(...l);else for(t&&r.splice(e,t);a0?(splice(r,r.length,0,e),r):e}const hasOwnProperty={}.hasOwnProperty;function combineExtensions(r){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function normalizeIdentifier(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const asciiAlpha=regexCheck(/[A-Za-z]/),asciiAlphanumeric=regexCheck(/[\dA-Za-z]/),asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(r){return r!==null&&(r<32||r===127)}const asciiDigit=regexCheck(/\d/),asciiHexDigit=regexCheck(/[\dA-Fa-f]/),asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(r){return r!==null&&r<-2}function markdownLineEndingOrSpace(r){return r!==null&&(r<0||r===32)}function markdownSpace(r){return r===-2||r===-1||r===32}const unicodePunctuation=regexCheck(new RegExp("\\p{P}|\\p{S}","u")),unicodeWhitespace=regexCheck(/\s/);function regexCheck(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function normalizeUri(r){const e=[];let t=-1,n=0,i=0;for(;++t55295&&a<57344){const u=r.charCodeAt(t+1);a<56320&&u>56319&&u<57344?(l=String.fromCharCode(a,u),i=1):l="�"}else l=String.fromCharCode(a);l&&(e.push(r.slice(n,t),encodeURIComponent(l)),n=t+i+1,l=""),i&&(t+=i,i=0)}return e.join("")+r.slice(n)}function factorySpace(r,e,t,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(d){return markdownSpace(d)?(r.enter(t),u(d)):e(d)}function u(d){return markdownSpace(d)&&a++l))return;const M=e.events.length;let P=M,A,C;for(;P--;)if(e.events[P][0]==="exit"&&e.events[P][1].type==="chunkFlow"){if(A){C=e.events[P][1].end;break}A=!0}for(b(n),E=M;Ew;){const T=t[S];e.containerState=T[1],T[0].exit.call(e,r)}t.length=w}function x(){i.write([null]),a=void 0,i=void 0,e.containerState._closeFlow=void 0}}function tokenizeContainer(r,e,t){return factorySpace(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(r){if(r===null||markdownLineEndingOrSpace(r)||unicodeWhitespace(r))return 1;if(unicodePunctuation(r))return 2}function resolveAll(r,e,t){const n=[];let i=-1;for(;++i1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;const s={...r[n][1].end},o={...r[t][1].start};movePoint(s,-d),movePoint(o,d),l={type:d>1?"strongSequence":"emphasisSequence",start:s,end:{...r[n][1].end}},u={type:d>1?"strongSequence":"emphasisSequence",start:{...r[t][1].start},end:o},a={type:d>1?"strongText":"emphasisText",start:{...r[n][1].end},end:{...r[t][1].start}},i={type:d>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},r[n][1].end={...l.start},r[t][1].start={...u.end},f=[],r[n][1].end.offset-r[n][1].start.offset&&(f=push(f,[["enter",r[n][1],e],["exit",r[n][1],e]])),f=push(f,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",a,e]]),f=push(f,resolveAll(e.parser.constructs.insideSpan.null,r.slice(n+1,t),e)),f=push(f,[["exit",a,e],["enter",u,e],["exit",u,e],["exit",i,e]]),r[t][1].end.offset-r[t][1].start.offset?(m=2,f=push(f,[["enter",r[t][1],e],["exit",r[t][1],e]])):m=0,splice(r,n-1,t-n+3,f),t=n+f.length-m-2;break}}for(t=-1;++t0&&markdownSpace(E)?factorySpace(r,x,"linePrefix",a+1)(E):x(E)}function x(E){return E===null||markdownLineEnding(E)?r.check(nonLazyContinuation,y,S)(E):(r.enter("codeFlowValue"),w(E))}function w(E){return E===null||markdownLineEnding(E)?(r.exit("codeFlowValue"),x(E)):(r.consume(E),w)}function S(E){return r.exit("codeFenced"),e(E)}function T(E,M,P){let A=0;return C;function C(W){return E.enter("lineEnding"),E.consume(W),E.exit("lineEnding"),D}function D(W){return E.enter("codeFencedFence"),markdownSpace(W)?factorySpace(E,k,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):k(W)}function k(W){return W===u?(E.enter("codeFencedFenceSequence"),j(W)):P(W)}function j(W){return W===u?(A++,E.consume(W),j):A>=l?(E.exit("codeFencedFenceSequence"),markdownSpace(W)?factorySpace(E,I,"whitespace")(W):I(W)):P(W)}function I(W){return W===null||markdownLineEnding(W)?(E.exit("codeFencedFence"),M(W)):P(W)}}}function tokenizeNonLazyContinuation(r,e,t){const n=this;return i;function i(l){return l===null?t(l):(r.enter("lineEnding"),r.consume(l),r.exit("lineEnding"),a)}function a(l){return n.parser.lazy[n.now().line]?t(l):e(l)}}const codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented},furtherStart={partial:!0,tokenize:tokenizeFurtherStart};function tokenizeCodeIndented(r,e,t){const n=this;return i;function i(f){return r.enter("codeIndented"),factorySpace(r,a,"linePrefix",5)(f)}function a(f){const m=n.events[n.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):t(f)}function l(f){return f===null?d(f):markdownLineEnding(f)?r.attempt(furtherStart,l,d)(f):(r.enter("codeFlowValue"),u(f))}function u(f){return f===null||markdownLineEnding(f)?(r.exit("codeFlowValue"),l(f)):(r.consume(f),u)}function d(f){return r.exit("codeIndented"),e(f)}}function tokenizeFurtherStart(r,e,t){const n=this;return i;function i(l){return n.parser.lazy[n.now().line]?t(l):markdownLineEnding(l)?(r.enter("lineEnding"),r.consume(l),r.exit("lineEnding"),i):factorySpace(r,a,"linePrefix",5)(l)}function a(l){const u=n.events[n.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?e(l):markdownLineEnding(l)?i(l):t(l)}}const codeText={name:"codeText",previous,resolve:resolveCodeText,tokenize:tokenizeCodeText};function resolveCodeText(r){let e=r.length-4,t=3,n,i;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(n=t;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-n+this.left.length).reverse()),i}splice(e,t,n){const i=t||0;this.setCursor(Math.trunc(e));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&chunkedPush(this.left,n),a.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),chunkedPush(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),chunkedPush(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(l):r.interrupt(n.parser.constructs.flow,t,e)(l)}}function factoryDestination(r,e,t,n,i,a,l,u,d){const f=d||Number.POSITIVE_INFINITY;let m=0;return s;function s(b){return b===60?(r.enter(n),r.enter(i),r.enter(a),r.consume(b),r.exit(a),o):b===null||b===32||b===41||asciiControl(b)?t(b):(r.enter(n),r.enter(l),r.enter(u),r.enter("chunkString",{contentType:"string"}),y(b))}function o(b){return b===62?(r.enter(a),r.consume(b),r.exit(a),r.exit(i),r.exit(n),e):(r.enter(u),r.enter("chunkString",{contentType:"string"}),c(b))}function c(b){return b===62?(r.exit("chunkString"),r.exit(u),o(b)):b===null||b===60||markdownLineEnding(b)?t(b):(r.consume(b),b===92?v:c)}function v(b){return b===60||b===62||b===92?(r.consume(b),c):c(b)}function y(b){return!m&&(b===null||b===41||markdownLineEndingOrSpace(b))?(r.exit("chunkString"),r.exit(u),r.exit(l),r.exit(n),e(b)):m999||c===null||c===91||c===93&&!d||c===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?t(c):c===93?(r.exit(a),r.enter(i),r.consume(c),r.exit(i),r.exit(n),e):markdownLineEnding(c)?(r.enter("lineEnding"),r.consume(c),r.exit("lineEnding"),m):(r.enter("chunkString",{contentType:"string"}),s(c))}function s(c){return c===null||c===91||c===93||markdownLineEnding(c)||u++>999?(r.exit("chunkString"),m(c)):(r.consume(c),d||(d=!markdownSpace(c)),c===92?o:s)}function o(c){return c===91||c===92||c===93?(r.consume(c),u++,s):s(c)}}function factoryTitle(r,e,t,n,i,a){let l;return u;function u(o){return o===34||o===39||o===40?(r.enter(n),r.enter(i),r.consume(o),r.exit(i),l=o===40?41:o,d):t(o)}function d(o){return o===l?(r.enter(i),r.consume(o),r.exit(i),r.exit(n),e):(r.enter(a),f(o))}function f(o){return o===l?(r.exit(a),d(l)):o===null?t(o):markdownLineEnding(o)?(r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),factorySpace(r,f,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),m(o))}function m(o){return o===l||o===null||markdownLineEnding(o)?(r.exit("chunkString"),f(o)):(r.consume(o),o===92?s:m)}function s(o){return o===l||o===92?(r.consume(o),m):m(o)}}function factoryWhitespace(r,e){let t;return n;function n(i){return markdownLineEnding(i)?(r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),t=!0,n):markdownSpace(i)?factorySpace(r,n,t?"linePrefix":"lineSuffix")(i):e(i)}}const definition={name:"definition",tokenize:tokenizeDefinition},titleBefore={partial:!0,tokenize:tokenizeTitleBefore};function tokenizeDefinition(r,e,t){const n=this;let i;return a;function a(c){return r.enter("definition"),l(c)}function l(c){return factoryLabel.call(n,r,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(c)}function u(c){return i=normalizeIdentifier(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),c===58?(r.enter("definitionMarker"),r.consume(c),r.exit("definitionMarker"),d):t(c)}function d(c){return markdownLineEndingOrSpace(c)?factoryWhitespace(r,f)(c):f(c)}function f(c){return factoryDestination(r,m,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(c)}function m(c){return r.attempt(titleBefore,s,s)(c)}function s(c){return markdownSpace(c)?factorySpace(r,o,"whitespace")(c):o(c)}function o(c){return c===null||markdownLineEnding(c)?(r.exit("definition"),n.parser.defined.push(i),e(c)):t(c)}}function tokenizeTitleBefore(r,e,t){return n;function n(u){return markdownLineEndingOrSpace(u)?factoryWhitespace(r,i)(u):t(u)}function i(u){return factoryTitle(r,a,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function a(u){return markdownSpace(u)?factorySpace(r,l,"whitespace")(u):l(u)}function l(u){return u===null||markdownLineEnding(u)?e(u):t(u)}}const hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(r,e,t){return n;function n(a){return r.enter("hardBreakEscape"),r.consume(a),i}function i(a){return markdownLineEnding(a)?(r.exit("hardBreakEscape"),e(a)):t(a)}}const headingAtx={name:"headingAtx",resolve:resolveHeadingAtx,tokenize:tokenizeHeadingAtx};function resolveHeadingAtx(r,e){let t=r.length-2,n=3,i,a;return r[n][1].type==="whitespace"&&(n+=2),t-2>n&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(n===t-1||t-4>n&&r[t-2][1].type==="whitespace")&&(t-=n+1===t?2:4),t>n&&(i={type:"atxHeadingText",start:r[n][1].start,end:r[t][1].end},a={type:"chunkText",start:r[n][1].start,end:r[t][1].end,contentType:"text"},splice(r,n,t-n+1,[["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e]])),r}function tokenizeHeadingAtx(r,e,t){let n=0;return i;function i(m){return r.enter("atxHeading"),a(m)}function a(m){return r.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&n++<6?(r.consume(m),l):m===null||markdownLineEndingOrSpace(m)?(r.exit("atxHeadingSequence"),u(m)):t(m)}function u(m){return m===35?(r.enter("atxHeadingSequence"),d(m)):m===null||markdownLineEnding(m)?(r.exit("atxHeading"),e(m)):markdownSpace(m)?factorySpace(r,u,"whitespace")(m):(r.enter("atxHeadingText"),f(m))}function d(m){return m===35?(r.consume(m),d):(r.exit("atxHeadingSequence"),u(m))}function f(m){return m===null||m===35||markdownLineEndingOrSpace(m)?(r.exit("atxHeadingText"),u(m)):(r.consume(m),f)}}const htmlBlockNames=["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"],htmlRawNames=["pre","script","style","textarea"],htmlFlow={concrete:!0,name:"htmlFlow",resolveTo:resolveToHtmlFlow,tokenize:tokenizeHtmlFlow},blankLineBefore={partial:!0,tokenize:tokenizeBlankLineBefore},nonLazyContinuationStart={partial:!0,tokenize:tokenizeNonLazyContinuationStart};function resolveToHtmlFlow(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function tokenizeHtmlFlow(r,e,t){const n=this;let i,a,l,u,d;return f;function f(z){return m(z)}function m(z){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(z),s}function s(z){return z===33?(r.consume(z),o):z===47?(r.consume(z),a=!0,y):z===63?(r.consume(z),i=3,n.interrupt?e:B):asciiAlpha(z)?(r.consume(z),l=String.fromCharCode(z),_):t(z)}function o(z){return z===45?(r.consume(z),i=2,c):z===91?(r.consume(z),i=5,u=0,v):asciiAlpha(z)?(r.consume(z),i=4,n.interrupt?e:B):t(z)}function c(z){return z===45?(r.consume(z),n.interrupt?e:B):t(z)}function v(z){const _e="CDATA[";return z===_e.charCodeAt(u++)?(r.consume(z),u===_e.length?n.interrupt?e:k:v):t(z)}function y(z){return asciiAlpha(z)?(r.consume(z),l=String.fromCharCode(z),_):t(z)}function _(z){if(z===null||z===47||z===62||markdownLineEndingOrSpace(z)){const _e=z===47,fe=l.toLowerCase();return!_e&&!a&&htmlRawNames.includes(fe)?(i=1,n.interrupt?e(z):k(z)):htmlBlockNames.includes(l.toLowerCase())?(i=6,_e?(r.consume(z),b):n.interrupt?e(z):k(z)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?t(z):a?x(z):w(z))}return z===45||asciiAlphanumeric(z)?(r.consume(z),l+=String.fromCharCode(z),_):t(z)}function b(z){return z===62?(r.consume(z),n.interrupt?e:k):t(z)}function x(z){return markdownSpace(z)?(r.consume(z),x):C(z)}function w(z){return z===47?(r.consume(z),C):z===58||z===95||asciiAlpha(z)?(r.consume(z),S):markdownSpace(z)?(r.consume(z),w):C(z)}function S(z){return z===45||z===46||z===58||z===95||asciiAlphanumeric(z)?(r.consume(z),S):T(z)}function T(z){return z===61?(r.consume(z),E):markdownSpace(z)?(r.consume(z),T):w(z)}function E(z){return z===null||z===60||z===61||z===62||z===96?t(z):z===34||z===39?(r.consume(z),d=z,M):markdownSpace(z)?(r.consume(z),E):P(z)}function M(z){return z===d?(r.consume(z),d=null,A):z===null||markdownLineEnding(z)?t(z):(r.consume(z),M)}function P(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||markdownLineEndingOrSpace(z)?T(z):(r.consume(z),P)}function A(z){return z===47||z===62||markdownSpace(z)?w(z):t(z)}function C(z){return z===62?(r.consume(z),D):t(z)}function D(z){return z===null||markdownLineEnding(z)?k(z):markdownSpace(z)?(r.consume(z),D):t(z)}function k(z){return z===45&&i===2?(r.consume(z),L):z===60&&i===1?(r.consume(z),U):z===62&&i===4?(r.consume(z),X):z===63&&i===3?(r.consume(z),B):z===93&&i===5?(r.consume(z),Y):markdownLineEnding(z)&&(i===6||i===7)?(r.exit("htmlFlowData"),r.check(blankLineBefore,Z,j)(z)):z===null||markdownLineEnding(z)?(r.exit("htmlFlowData"),j(z)):(r.consume(z),k)}function j(z){return r.check(nonLazyContinuationStart,I,Z)(z)}function I(z){return r.enter("lineEnding"),r.consume(z),r.exit("lineEnding"),W}function W(z){return z===null||markdownLineEnding(z)?j(z):(r.enter("htmlFlowData"),k(z))}function L(z){return z===45?(r.consume(z),B):k(z)}function U(z){return z===47?(r.consume(z),l="",H):k(z)}function H(z){if(z===62){const _e=l.toLowerCase();return htmlRawNames.includes(_e)?(r.consume(z),X):k(z)}return asciiAlpha(z)&&l.length<8?(r.consume(z),l+=String.fromCharCode(z),H):k(z)}function Y(z){return z===93?(r.consume(z),B):k(z)}function B(z){return z===62?(r.consume(z),X):z===45&&i===2?(r.consume(z),B):k(z)}function X(z){return z===null||markdownLineEnding(z)?(r.exit("htmlFlowData"),Z(z)):(r.consume(z),X)}function Z(z){return r.exit("htmlFlow"),e(z)}}function tokenizeNonLazyContinuationStart(r,e,t){const n=this;return i;function i(l){return markdownLineEnding(l)?(r.enter("lineEnding"),r.consume(l),r.exit("lineEnding"),a):t(l)}function a(l){return n.parser.lazy[n.now().line]?t(l):e(l)}}function tokenizeBlankLineBefore(r,e,t){return n;function n(i){return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),r.attempt(blankLine,e,t)}}const htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(r,e,t){const n=this;let i,a,l;return u;function u(B){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(B),d}function d(B){return B===33?(r.consume(B),f):B===47?(r.consume(B),T):B===63?(r.consume(B),w):asciiAlpha(B)?(r.consume(B),P):t(B)}function f(B){return B===45?(r.consume(B),m):B===91?(r.consume(B),a=0,v):asciiAlpha(B)?(r.consume(B),x):t(B)}function m(B){return B===45?(r.consume(B),c):t(B)}function s(B){return B===null?t(B):B===45?(r.consume(B),o):markdownLineEnding(B)?(l=s,U(B)):(r.consume(B),s)}function o(B){return B===45?(r.consume(B),c):s(B)}function c(B){return B===62?L(B):B===45?o(B):s(B)}function v(B){const X="CDATA[";return B===X.charCodeAt(a++)?(r.consume(B),a===X.length?y:v):t(B)}function y(B){return B===null?t(B):B===93?(r.consume(B),_):markdownLineEnding(B)?(l=y,U(B)):(r.consume(B),y)}function _(B){return B===93?(r.consume(B),b):y(B)}function b(B){return B===62?L(B):B===93?(r.consume(B),b):y(B)}function x(B){return B===null||B===62?L(B):markdownLineEnding(B)?(l=x,U(B)):(r.consume(B),x)}function w(B){return B===null?t(B):B===63?(r.consume(B),S):markdownLineEnding(B)?(l=w,U(B)):(r.consume(B),w)}function S(B){return B===62?L(B):w(B)}function T(B){return asciiAlpha(B)?(r.consume(B),E):t(B)}function E(B){return B===45||asciiAlphanumeric(B)?(r.consume(B),E):M(B)}function M(B){return markdownLineEnding(B)?(l=M,U(B)):markdownSpace(B)?(r.consume(B),M):L(B)}function P(B){return B===45||asciiAlphanumeric(B)?(r.consume(B),P):B===47||B===62||markdownLineEndingOrSpace(B)?A(B):t(B)}function A(B){return B===47?(r.consume(B),L):B===58||B===95||asciiAlpha(B)?(r.consume(B),C):markdownLineEnding(B)?(l=A,U(B)):markdownSpace(B)?(r.consume(B),A):L(B)}function C(B){return B===45||B===46||B===58||B===95||asciiAlphanumeric(B)?(r.consume(B),C):D(B)}function D(B){return B===61?(r.consume(B),k):markdownLineEnding(B)?(l=D,U(B)):markdownSpace(B)?(r.consume(B),D):A(B)}function k(B){return B===null||B===60||B===61||B===62||B===96?t(B):B===34||B===39?(r.consume(B),i=B,j):markdownLineEnding(B)?(l=k,U(B)):markdownSpace(B)?(r.consume(B),k):(r.consume(B),I)}function j(B){return B===i?(r.consume(B),i=void 0,W):B===null?t(B):markdownLineEnding(B)?(l=j,U(B)):(r.consume(B),j)}function I(B){return B===null||B===34||B===39||B===60||B===61||B===96?t(B):B===47||B===62||markdownLineEndingOrSpace(B)?A(B):(r.consume(B),I)}function W(B){return B===47||B===62||markdownLineEndingOrSpace(B)?A(B):t(B)}function L(B){return B===62?(r.consume(B),r.exit("htmlTextData"),r.exit("htmlText"),e):t(B)}function U(B){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(B),r.exit("lineEnding"),H}function H(B){return markdownSpace(B)?factorySpace(r,Y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):Y(B)}function Y(B){return r.enter("htmlTextData"),l(B)}}const labelEnd={name:"labelEnd",resolveAll:resolveAllLabelEnd,resolveTo:resolveToLabelEnd,tokenize:tokenizeLabelEnd},resourceConstruct={tokenize:tokenizeResource},referenceFullConstruct={tokenize:tokenizeReferenceFull},referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(r){let e=-1;const t=[];for(;++e=3&&(f===null||markdownLineEnding(f))?(r.exit("thematicBreak"),e(f)):t(f)}function d(f){return f===i?(r.consume(f),n++,d):(r.exit("thematicBreakSequence"),markdownSpace(f)?factorySpace(r,u,"whitespace")(f):u(f))}}const list$1={continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd,name:"list",tokenize:tokenizeListStart},listItemPrefixWhitespaceConstruct={partial:!0,tokenize:tokenizeListItemPrefixWhitespace},indentConstruct={partial:!0,tokenize:tokenizeIndent};function tokenizeListStart(r,e,t){const n=this,i=n.events[n.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return u;function u(c){const v=n.containerState.type||(c===42||c===43||c===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!n.containerState.marker||c===n.containerState.marker:asciiDigit(c)){if(n.containerState.type||(n.containerState.type=v,r.enter(v,{_container:!0})),v==="listUnordered")return r.enter("listItemPrefix"),c===42||c===45?r.check(thematicBreak$1,t,f)(c):f(c);if(!n.interrupt||c===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),d(c)}return t(c)}function d(c){return asciiDigit(c)&&++l<10?(r.consume(c),d):(!n.interrupt||l<2)&&(n.containerState.marker?c===n.containerState.marker:c===41||c===46)?(r.exit("listItemValue"),f(c)):t(c)}function f(c){return r.enter("listItemMarker"),r.consume(c),r.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||c,r.check(blankLine,n.interrupt?t:m,r.attempt(listItemPrefixWhitespaceConstruct,o,s))}function m(c){return n.containerState.initialBlankLine=!0,a++,o(c)}function s(c){return markdownSpace(c)?(r.enter("listItemPrefixWhitespace"),r.consume(c),r.exit("listItemPrefixWhitespace"),o):t(c)}function o(c){return n.containerState.size=a+n.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(c)}}function tokenizeListContinuation(r,e,t){const n=this;return n.containerState._closeFlow=void 0,r.check(blankLine,i,a);function i(u){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,factorySpace(r,e,"listItemIndent",n.containerState.size+1)(u)}function a(u){return n.containerState.furtherBlankLines||!markdownSpace(u)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,l(u)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,r.attempt(indentConstruct,e,l)(u))}function l(u){return n.containerState._closeFlow=!0,n.interrupt=void 0,factorySpace(r,r.attempt(list$1,e,t),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function tokenizeIndent(r,e,t){const n=this;return factorySpace(r,i,"listItemIndent",n.containerState.size+1);function i(a){const l=n.events[n.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===n.containerState.size?e(a):t(a)}}function tokenizeListEnd(r){r.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(r,e,t){const n=this;return factorySpace(r,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){const l=n.events[n.events.length-1];return!markdownSpace(a)&&l&&l[1].type==="listItemPrefixWhitespace"?e(a):t(a)}}const setextUnderline={name:"setextUnderline",resolveTo:resolveToSetextUnderline,tokenize:tokenizeSetextUnderline};function resolveToSetextUnderline(r,e){let t=r.length,n,i,a;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){n=t;break}r[t][1].type==="paragraph"&&(i=t)}else r[t][1].type==="content"&&r.splice(t,1),!a&&r[t][1].type==="definition"&&(a=t);const l={type:"setextHeading",start:{...r[i][1].start},end:{...r[r.length-1][1].end}};return r[i][1].type="setextHeadingText",a?(r.splice(i,0,["enter",l,e]),r.splice(a+1,0,["exit",r[n][1],e]),r[n][1].end={...r[a][1].end}):r[n][1]=l,r.push(["exit",l,e]),r}function tokenizeSetextUnderline(r,e,t){const n=this;let i;return a;function a(f){let m=n.events.length,s;for(;m--;)if(n.events[m][1].type!=="lineEnding"&&n.events[m][1].type!=="linePrefix"&&n.events[m][1].type!=="content"){s=n.events[m][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||s)?(r.enter("setextHeadingLine"),i=f,l(f)):t(f)}function l(f){return r.enter("setextHeadingLineSequence"),u(f)}function u(f){return f===i?(r.consume(f),u):(r.exit("setextHeadingLineSequence"),markdownSpace(f)?factorySpace(r,d,"lineSuffix")(f):d(f))}function d(f){return f===null||markdownLineEnding(f)?(r.exit("setextHeadingLine"),e(f)):t(f)}}const flow$1={tokenize:initializeFlow};function initializeFlow(r){const e=this,t=r.attempt(blankLine,n,r.attempt(this.parser.constructs.flowInitial,i,factorySpace(r,r.attempt(this.parser.constructs.flow,i,r.attempt(content,i)),"linePrefix")));return t;function n(a){if(a===null){r.consume(a);return}return r.enter("lineEndingBlank"),r.consume(a),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function i(a){if(a===null){r.consume(a);return}return r.enter("lineEnding"),r.consume(a),r.exit("lineEnding"),e.currentConstruct=void 0,t}}const resolver={resolveAll:createResolver()},string$1=initializeFactory("string"),text$2=initializeFactory("text");function initializeFactory(r){return{resolveAll:createResolver(r==="text"?resolveAllLineSuffixes:void 0),tokenize:e};function e(t){const n=this,i=this.parser.constructs[r],a=t.attempt(i,l,u);return l;function l(m){return f(m)?a(m):u(m)}function u(m){if(m===null){t.consume(m);return}return t.enter("data"),t.consume(m),d}function d(m){return f(m)?(t.exit("data"),a(m)):(t.consume(m),d)}function f(m){if(m===null)return!0;const s=i[m];let o=-1;if(s)for(;++o-1){const u=l[0];typeof u=="string"?l[0]=u.slice(n):l.shift()}a>0&&l.push(r[i].slice(0,a))}return l}function serializeChunks(r,e){let t=-1;const n=[];let i;for(;++t0){const Yt=xt.tokenStack[xt.tokenStack.length-1];(Yt[1]||defaultOnError).call(xt,void 0,Yt[0])}for(bt.position={start:point$1(Ce.length>0?Ce[0][1].start:{line:1,column:1,offset:0}),end:point$1(Ce.length>0?Ce[Ce.length-2][1].end:{line:1,column:1,offset:0})},Nt=-1;++Nt1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};r.patch(e,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return r.patch(e,f),r.applyData(e,f)}function heading(r,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function html(r,e){if(r.options.allowDangerousHtml){const t={type:"raw",value:e.value};return r.patch(e,t),r.applyData(e,t)}}function revert(r,e){const t=e.referenceType;let n="]";if(t==="collapsed"?n+="[]":t==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=r.all(e),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=n:i.push({type:"text",value:n}),i}function imageReference(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return revert(r,e);const i={src:normalizeUri(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"img",properties:i,children:[]};return r.patch(e,a),r.applyData(e,a)}function image(r,e){const t={src:normalizeUri(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const n={type:"element",tagName:"img",properties:t,children:[]};return r.patch(e,n),r.applyData(e,n)}function inlineCode(r,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};r.patch(e,t);const n={type:"element",tagName:"code",properties:{},children:[t]};return r.patch(e,n),r.applyData(e,n)}function linkReference(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return revert(r,e);const i={href:normalizeUri(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const a={type:"element",tagName:"a",properties:i,children:r.all(e)};return r.patch(e,a),r.applyData(e,a)}function link(r,e){const t={href:normalizeUri(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const n={type:"element",tagName:"a",properties:t,children:r.all(e)};return r.patch(e,n),r.applyData(e,n)}function listItem(r,e,t){const n=r.all(e),i=t?listLoose(t):listItemLoose(e),a={},l=[];if(typeof e.checked=="boolean"){const m=n[0];let s;m&&m.type==="element"&&m.tagName==="p"?s=m:(s={type:"element",tagName:"p",properties:{},children:[]},n.unshift(s)),s.children.length>0&&s.children.unshift({type:"text",value:" "}),s.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let u=-1;for(;++u1}function list(r,e){const t={},n=r.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++i0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function position(r){const e=pointStart(r),t=pointEnd(r);if(e&&t)return{start:e,end:t}}function table(r,e){const t=r.all(e),n=t.shift(),i=[];if(n){const l={type:"element",tagName:"thead",properties:{},children:r.wrap([n],!0)};r.patch(e.children[0],l),i.push(l)}if(t.length>0){const l={type:"element",tagName:"tbody",properties:{},children:r.wrap(t,!0)},u=pointStart(e.children[1]),d=pointEnd(e.children[e.children.length-1]);u&&d&&(l.position={start:u,end:d}),i.push(l)}const a={type:"element",tagName:"table",properties:{},children:r.wrap(i,!0)};return r.patch(e,a),r.applyData(e,a)}function tableRow(r,e,t){const n=t?t.children:void 0,a=(n?n.indexOf(e):1)===0?"th":"td",l=t&&t.type==="table"?t.align:void 0,u=l?l.length:e.children.length;let d=-1;const f=[];for(;++d0,!0),n[0]),i=n.index+n[0].length,n=t.exec(e);return a.push(trimLine(e.slice(i),i>0,!1)),a.join("")}function trimLine(r,e,t){let n=0,i=r.length;if(e){let a=r.codePointAt(n);for(;a===tab||a===space;)n++,a=r.codePointAt(n)}if(t){let a=r.codePointAt(i-1);for(;a===tab||a===space;)i--,a=r.codePointAt(i-1)}return i>n?r.slice(n,i):""}function text(r,e){const t={type:"text",value:trimLines(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function thematicBreak(r,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}const handlers={blockquote,break:hardBreak,code,delete:strikethrough,emphasis,footnoteReference,heading,html,imageReference,image,inlineCode,linkReference,link,listItem,list,paragraph,root,strong,table,tableCell,tableRow,text,thematicBreak,toml:ignore,yaml:ignore,definition:ignore,footnoteDefinition:ignore};function ignore(){}const VOID=-1,PRIMITIVE=0,ARRAY=1,OBJECT=2,DATE=3,REGEXP=4,MAP=5,SET=6,ERROR=7,BIGINT=8,env=typeof self=="object"?self:globalThis,deserializer=(r,e)=>{const t=(i,a)=>(r.set(a,i),i),n=i=>{if(r.has(i))return r.get(i);const[a,l]=e[i];switch(a){case PRIMITIVE:case VOID:return t(l,i);case ARRAY:{const u=t([],i);for(const d of l)u.push(n(d));return u}case OBJECT:{const u=t({},i);for(const[d,f]of l)u[n(d)]=n(f);return u}case DATE:return t(new Date(l),i);case REGEXP:{const{source:u,flags:d}=l;return t(new RegExp(u,d),i)}case MAP:{const u=t(new Map,i);for(const[d,f]of l)u.set(n(d),n(f));return u}case SET:{const u=t(new Set,i);for(const d of l)u.add(n(d));return u}case ERROR:{const{name:u,message:d}=l;return t(new env[u](d),i)}case BIGINT:return t(BigInt(l),i);case"BigInt":return t(Object(BigInt(l)),i)}return t(new env[a](l),i)};return n},deserialize=r=>deserializer(new Map,r)(0),EMPTY="",{toString}={},{keys}=Object,typeOf=r=>{const e=typeof r;if(e!=="object"||!r)return[PRIMITIVE,e];const t=toString.call(r).slice(8,-1);switch(t){case"Array":return[ARRAY,EMPTY];case"Object":return[OBJECT,EMPTY];case"Date":return[DATE,EMPTY];case"RegExp":return[REGEXP,EMPTY];case"Map":return[MAP,EMPTY];case"Set":return[SET,EMPTY]}return t.includes("Array")?[ARRAY,t]:t.includes("Error")?[ERROR,t]:[OBJECT,t]},shouldSkip=([r,e])=>r===PRIMITIVE&&(e==="function"||e==="symbol"),serializer=(r,e,t,n)=>{const i=(l,u)=>{const d=n.push(l)-1;return t.set(u,d),d},a=l=>{if(t.has(l))return t.get(l);let[u,d]=typeOf(l);switch(u){case PRIMITIVE:{let m=l;switch(d){case"bigint":u=BIGINT,m=l.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+d);m=null;break;case"undefined":return i([VOID],l)}return i([u,m],l)}case ARRAY:{if(d)return i([d,[...l]],l);const m=[],s=i([u,m],l);for(const o of l)m.push(a(o));return s}case OBJECT:{if(d)switch(d){case"BigInt":return i([d,l.toString()],l);case"Boolean":case"Number":case"String":return i([d,l.valueOf()],l)}if(e&&"toJSON"in l)return a(l.toJSON());const m=[],s=i([u,m],l);for(const o of keys(l))(r||!shouldSkip(typeOf(l[o])))&&m.push([a(o),a(l[o])]);return s}case DATE:return i([u,l.toISOString()],l);case REGEXP:{const{source:m,flags:s}=l;return i([u,{source:m,flags:s}],l)}case MAP:{const m=[],s=i([u,m],l);for(const[o,c]of l)(r||!(shouldSkip(typeOf(o))||shouldSkip(typeOf(c))))&&m.push([a(o),a(c)]);return s}case SET:{const m=[],s=i([u,m],l);for(const o of l)(r||!shouldSkip(typeOf(o)))&&m.push(a(o));return s}}const{message:f}=l;return i([u,{name:d,message:f}],l)};return a},serialize=(r,{json:e,lossy:t}={})=>{const n=[];return serializer(!(e||t),!!e,new Map,n)(r),n},structuredClone$1=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?deserialize(serialize(r,e)):structuredClone(r):(r,e)=>deserialize(serialize(r,e));function defaultFootnoteBackContent(r,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function defaultFootnoteBackLabel(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function footer(r){const e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||defaultFootnoteBackContent,n=r.options.footnoteBackLabel||defaultFootnoteBackLabel,i=r.options.footnoteLabel||"Footnotes",a=r.options.footnoteLabelTagName||"h2",l=r.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d0&&v.push({type:"text",value:" "});let x=typeof t=="string"?t:t(d,c);typeof x=="string"&&(x={type:"text",value:x}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+o+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(d,c),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const _=m[m.length-1];if(_&&_.type==="element"&&_.tagName==="p"){const x=_.children[_.children.length-1];x&&x.type==="text"?x.value+=" ":_.children.push({type:"text",value:" "}),_.children.push(...v)}else m.push(...v);const b={type:"element",tagName:"li",properties:{id:e+"fn-"+o},children:r.wrap(m,!0)};r.patch(f,b),u.push(b)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...structuredClone$1(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:r.wrap(u,!0)},{type:"text",value:` -`}]}}const convert=function(r){if(r==null)return ok;if(typeof r=="function")return castFactory(r);if(typeof r=="object")return Array.isArray(r)?anyFactory(r):propsFactory(r);if(typeof r=="string")return typeFactory(r);throw new Error("Expected function, string, or object as test")};function anyFactory(r){const e=[];let t=-1;for(;++t":""))+")"})}return o;function o(){let c=empty,v,y,_;if((!e||a(d,f,m[m.length-1]||void 0))&&(c=toResult(t(d,m)),c[0]===EXIT))return c;if("children"in d&&d.children){const b=d;if(b.children&&c[0]!==SKIP)for(y=(n?b.children.length:-1)+l,_=m.concat(b);y>-1&&y0&&t.push({type:"text",value:` -`}),t}function trimMarkdownSpaceStart(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function toHast(r,e){const t=createState(r,e),n=t.one(r,void 0),i=footer(t),a=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&a.children.push({type:"text",value:` -`},i),a}function remarkRehype(r,e){return r&&"run"in r?async function(t,n){const i=toHast(t,{file:n,...e});await r.run(i,n)}:function(t,n){return toHast(t,{file:n,...r||e})}}function bail(r){if(r)throw r}var extend$1,hasRequiredExtend;function requireExtend(){if(hasRequiredExtend)return extend$1;hasRequiredExtend=1;var r=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},a=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var m=r.call(f,"constructor"),s=f.constructor&&f.constructor.prototype&&r.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!s)return!1;var o;for(o in f);return typeof o>"u"||r.call(f,o)},l=function(f,m){t&&m.name==="__proto__"?t(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},u=function(f,m){if(m==="__proto__")if(r.call(f,m)){if(n)return n(f,m).value}else return;return f[m]};return extend$1=function d(){var f,m,s,o,c,v,y=arguments[0],_=1,b=arguments.length,x=!1;for(typeof y=="boolean"&&(x=y,y=arguments[1]||{},_=2),(y==null||typeof y!="object"&&typeof y!="function")&&(y={});_l.length;let d;u&&l.push(i);try{d=r.apply(this,l)}catch(f){const m=f;if(u&&t)throw m;return i(m)}u||(d&&d.then&&typeof d.then=="function"?d.then(a,i):d instanceof Error?i(d):a(d))}function i(l,...u){t||(t=!0,e(l,...u))}function a(l){i(null,l)}}class VFileMessage extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",a={},l=!1;if(t&&("line"in t&&"column"in t?a={place:t}:"start"in t&&"end"in t?a={place:t}:"type"in t?a={ancestors:[t],place:t.position}:a={...t}),typeof e=="string"?i=e:!a.cause&&e&&(l=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof n=="string"){const d=n.indexOf(":");d===-1?a.ruleId=n:(a.source=n.slice(0,d),a.ruleId=n.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const u=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=u?u.line:void 0,this.name=stringifyPosition(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}VFileMessage.prototype.file="";VFileMessage.prototype.name="";VFileMessage.prototype.reason="";VFileMessage.prototype.message="";VFileMessage.prototype.stack="";VFileMessage.prototype.column=void 0;VFileMessage.prototype.line=void 0;VFileMessage.prototype.ancestors=void 0;VFileMessage.prototype.cause=void 0;VFileMessage.prototype.fatal=void 0;VFileMessage.prototype.place=void 0;VFileMessage.prototype.ruleId=void 0;VFileMessage.prototype.source=void 0;const minpath={basename,dirname,extname,join,sep:"/"};function basename(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(r);let t=0,n=-1,i=r.length,a;if(e===void 0||e.length===0||e.length>r.length){for(;i--;)if(r.codePointAt(i)===47){if(a){t=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":r.slice(t,n)}if(e===r)return"";let l=-1,u=e.length-1;for(;i--;)if(r.codePointAt(i)===47){if(a){t=i+1;break}}else l<0&&(a=!0,l=i+1),u>-1&&(r.codePointAt(i)===e.codePointAt(u--)?u<0&&(n=i):(u=-1,n=l));return t===n?n=l:n<0&&(n=r.length),r.slice(t,n)}function dirname(r){if(assertPath$1(r),r.length===0)return".";let e=-1,t=r.length,n;for(;--t;)if(r.codePointAt(t)===47){if(n){e=t;break}}else n||(n=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function extname(r){assertPath$1(r);let e=r.length,t=-1,n=0,i=-1,a=0,l;for(;e--;){const u=r.codePointAt(e);if(u===47){if(l){n=e+1;break}continue}t<0&&(l=!0,t=e+1),u===46?i<0?i=e:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||t<0||a===0||a===1&&i===t-1&&i===n+1?"":r.slice(i,t)}function join(...r){let e=-1,t;for(;++e0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function normalizeString(r,e){let t="",n=0,i=-1,a=0,l=-1,u,d;for(;++l<=r.length;){if(l2){if(d=t.lastIndexOf("/"),d!==t.length-1){d<0?(t="",n=0):(t=t.slice(0,d),n=t.length-1-t.lastIndexOf("/")),i=l,a=0;continue}}else if(t.length>0){t="",n=0,i=l,a=0;continue}}e&&(t=t.length>0?t+"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,l):t=r.slice(i+1,l),n=l-i-1;i=l,a=0}else u===46&&a>-1?a++:a=-1}return t}function assertPath$1(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}const minproc={cwd};function cwd(){return"/"}function isUrl(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function urlToPath(r){if(typeof r=="string")r=new URL(r);else if(!isUrl(r)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return getPathFromURLPosix(r)}function getPathFromURLPosix(r){if(r.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=r.pathname;let t=-1;for(;++t0){let[c,...v]=m;const y=n[o][1];isPlainObject(y)&&isPlainObject(c)&&(c=extend(!0,y,c)),n[o]=[f,c,...v]}}}}const unified=new Processor().freeze();function assertParser(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function assertCompiler(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function assertUnfrozen(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(r){if(!isPlainObject(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function assertDone(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function vfile(r){return looksLikeAVFile(r)?r:new VFile(r)}function looksLikeAVFile(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function looksLikeAValue(r){return typeof r=="string"||isUint8Array(r)}function isUint8Array(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}function useMarkdown(){const r=unified().use(remarkParse).use(remarkRehype).use(rehypeStringify);return{process:e=>r.processSync(e).toString()}}const _hoisted_1$a={relative:"",px:"{nextTick().then(()=>{n.update(),i.value=n.height.value})}),u(async()=>{nextTick().then(()=>{n.update(),i.value=n.height.value})}),(d,f)=>{const m=resolveDirective("auto-animate");return openBlock(),createElementBlock("div",_hoisted_1$a,[f[3]||(f[3]=createBaseVNode("div",{"flex-1":""},null,-1)),withDirectives((openBlock(),createElementBlock("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[f[2]||(f[2]=createBaseVNode("div",{"flex-1":""},null,-1)),(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t),(s,o)=>(openBlock(),createElementBlock("div",{key:o,"mb-2":""},[s.role==="assistant"?(openBlock(),createElementBlock("div",_hoisted_2$9,[createBaseVNode("div",_hoisted_3$8,[f[0]||(f[0]=createBaseVNode("div",null,[createBaseVNode("span",{"text-xs":"",text:"pink-400/90 dark:pink-600/90","font-semibold":"",class:"inline {await f(M)}});async function b(){await f(e.value)}const{destroy:x,start:w}=useMicVAD(d,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:M=>{t.value=!1,T(M)},auto:!1});function S(){y.value!=="loading"&&(v(),w())}async function T(M){await s.resume();const P=await encodeWAVToBase64(M,s.sampleRate);c({type:"generate",data:{audio:P,language:"en"}})}async function E(M){const P=M.target,A=a.value.find(C=>C.deviceId===P.value);if(!A){l.value=void 0;return}l.value=A}return watch(u,async M=>{M==="false"&&(x(),_())}),m(async()=>{e.value=""}),(M,P)=>{const A=_sfc_main$k,C=_sfc_main$h;return openBlock(),createElementBlock("div",_hoisted_1$9,[createBaseVNode("fieldset",_hoisted_2$8,[createBaseVNode("label",{class:normalizeClass([n.value==="chat"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="chat"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="chat","aria-checked":n.value==="chat",border:"solid l-2 t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":P[0]||(P[0]=D=>n.value=D),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[vModelRadio,n.value]]),P[5]||(P[5]=createBaseVNode("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),P[6]||(P[6]=createBaseVNode("div",{flex:"~ row","items-center":""},[createBaseVNode("span",{"min-w":"3em"},"Chat")],-1))],10,_hoisted_3$7),createBaseVNode("label",{class:normalizeClass([n.value==="custom"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="custom"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="custom","aria-checked":n.value==="custom",border:"solid t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":P[1]||(P[1]=D=>n.value=D),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[vModelRadio,n.value]]),P[7]||(P[7]=createBaseVNode("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),P[8]||(P[8]=createBaseVNode("div",{flex:"~ row","items-center":""},[createBaseVNode("span",null,"Custom")],-1))],10,_hoisted_4$5),createBaseVNode("label",{class:normalizeClass([n.value==="clothes"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="clothes"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="clothes","aria-checked":n.value==="clothes",border:"solid r-2 t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":P[2]||(P[2]=D=>n.value=D),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[vModelRadio,n.value]]),P[9]||(P[9]=createBaseVNode("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),P[10]||(P[10]=createBaseVNode("div",{flex:"~ row","items-center":""},[createBaseVNode("span",null,"Clothes")],-1))],10,_hoisted_5$5)]),createBaseVNode("div",_hoisted_6$4,[createBaseVNode("div",_hoisted_7$3,[createVNode(_sfc_main$e,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=D),placeholder:unref(o)("stage.message"),text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500 placeholder:pink-300 placeholder:hover:pink-500 placeholder:dark:pink-300/50 placeholder:dark:hover:pink-500",bg:"pink-100 dark:pink-400/20","min-h":"[100px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",onSubmit:b},null,8,["modelValue","placeholder"])])])]),createBaseVNode("div",_hoisted_9$3,[createBaseVNode("button",{bg:"cyan-100 hover:cyan-200 dark:cyan-800 dark:hover:cyan-700",transition:"all duration-250 ease-in-out",text:"cyan-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:S},[createVNode(Transition,{mode:"out-in"},{default:withCtx(()=>[unref(y)===null?(openBlock(),createElementBlock("div",_hoisted_10$2," Load Models ")):unref(y)==="loading"?(openBlock(),createElementBlock("div",_hoisted_11$2,P[11]||(P[11]=[createBaseVNode("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1),createBaseVNode("span",null,"Loading",-1)]))):unref(y)==="ready"?(openBlock(),createElementBlock("div",_hoisted_12$2,P[12]||(P[12]=[createBaseVNode("div",{"i-lucide:check":"",class:"text-cyan"},null,-1),createBaseVNode("span",null,"Ready",-1)]))):createCommentVNode("",!0)]),_:1})]),createBaseVNode("div",_hoisted_13$2,[createVNode(C,null,{default:withCtx(()=>[i.value?(openBlock(),createElementBlock("fieldset",_hoisted_14$2,[(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(a),(D,k)=>(openBlock(),createElementBlock("label",{key:k,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[createBaseVNode("input",{type:"radio",name:"audioInput",value:D.deviceId,hidden:"",onChange:E},null,40,_hoisted_15$2),createBaseVNode("div",_hoisted_16$2,[createBaseVNode("div",_hoisted_17$2,[D.deviceId===unref(d)?(openBlock(),createElementBlock("div",_hoisted_18$2)):createCommentVNode("",!0)]),createBaseVNode("span",{"inline-block":"",class:normalizeClass([D.deviceId===unref(d)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},toDisplayString(D.label),3)])]))),128))])):createCommentVNode("",!0)]),_:1}),createBaseVNode("label",_hoisted_19$2,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":P[4]||(P[4]=D=>i.value=D),type:"checkbox",hidden:""},null,512),[[vModelCheckbox,i.value]]),P[13]||(P[13]=createBaseVNode("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),createBaseVNode("div",null,[t.value?(openBlock(),createElementBlock("span",_hoisted_21$2,"Listening...")):(openBlock(),createElementBlock("span",_hoisted_20$2,"Microphone"))])])])])])}}}),InteractiveArea=_export_sfc(_sfc_main$d,[["__scopeId","data-v-65a3f0ce"]]),_sfc_main$c={},_hoisted_1$8={"mb-1":"","w-full":"","gap-2":""};function _sfc_render(r,e){return openBlock(),createElementBlock("header",_hoisted_1$8,e[0]||(e[0]=[createBaseVNode("div",{flex:"~ 1","w-full":"","items-center":"","justify-center":"","gap-2":"","px-2":"","text-nowrap":"","text-lg":""},[createBaseVNode("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),createBaseVNode("div",{"font-cute":""},[createBaseVNode("span",null,"アイリ")])],-1)]))}const MobileHeader=_export_sfc(_sfc_main$c,[["render",_sfc_render]]);function Q$1(r,e){const t=typeof r=="string"&&!e?`${r}Context`:e,n=Symbol(t);return[i=>{const a=inject(n,i);if(a||a===null)return a;throw new Error(`Injection \`${n.toString()}\` not found. Component must be used within ${Array.isArray(r)?`one of the following components: ${r.join(", ")}`:`\`${r}\``}`)},i=>(provide(n,i),i)]}function Wt(r,e,t){const n=t.originalEvent.target,i=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:t});e&&n.addEventListener(r,e,{once:!0}),n.dispatchEvent(i)}function yt(r){return getCurrentScope()?(onScopeDispose(r),!0):!1}function ai(r){let e=!1,t;const n=effectScope(!0);return(...i)=>(e||(t=n.run(()=>r(...i)),e=!0),t)}function Sl(r){let e=0,t,n;const i=()=>{e-=1,n&&e<=0&&(n.stop(),t=void 0,n=void 0)};return(...a)=>(e+=1,t||(n=effectScope(!0),t=n.run(()=>r(...a))),yt(i),t)}function Ke(r){return typeof r=="function"?r():unref(r)}const Ye$1=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const oi=r=>typeof r<"u",si=Object.prototype.toString,ri$1=r=>si.call(r)==="[object Object]",Va$1=()=>{},Ko$1=ii();function ii(){var r,e;return Ye$1&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function $l(r){return getCurrentInstance()}function fi(r,e){$l()&&onBeforeUnmount(r,e)}function $e(r){var e;const t=Ke(r);return(e=t==null?void 0:t.$el)!=null?e:t}const Tt=Ye$1?window:void 0;function Le(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=Tt):[e,t,n,i]=r,!e)return Va$1;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const a=[],l=()=>{a.forEach(m=>m()),a.length=0},u=(m,s,o,c)=>(m.addEventListener(s,o,c),()=>m.removeEventListener(s,o,c)),d=watch(()=>[$e(e),Ke(i)],([m,s])=>{if(l(),!m)return;const o=ri$1(s)?{...s}:s;a.push(...t.flatMap(c=>n.map(v=>u(m,c,v,o))))},{immediate:!0,flush:"post"}),f=()=>{d(),l()};return yt(f),f}function yi(r){return typeof r=="function"?r:typeof r=="string"?e=>e.key===r:Array.isArray(r)?e=>r.includes(e.key):()=>!0}function jn(...r){let e,t,n={};r.length===3?(e=r[0],t=r[1],n=r[2]):r.length===2?typeof r[1]=="object"?(e=!0,t=r[0],n=r[1]):(e=r[0],t=r[1]):(e=!0,t=r[0]);const{target:i=Tt,eventName:a="keydown",passive:l=!1,dedupe:u=!1}=n,d=yi(e);return Le(i,a,f=>{f.repeat&&Ke(u)||d(f)&&t(f)},l)}function ja$1(){const r=ref$1(!1),e=getCurrentInstance();return e&&onMounted(()=>{r.value=!0},e),r}function bi(r){return JSON.parse(JSON.stringify(r))}function ne$1(r,e,t,n={}){var i,a,l;const{clone:u=!1,passive:d=!1,eventName:f,deep:m=!1,defaultValue:s,shouldEmit:o}=n,c=getCurrentInstance(),v=t||(c==null?void 0:c.emit)||((i=c==null?void 0:c.$emit)==null?void 0:i.bind(c))||((l=(a=c==null?void 0:c.proxy)==null?void 0:a.$emit)==null?void 0:l.bind(c==null?void 0:c.proxy));let y=f;y=y||`update:${e.toString()}`;const _=w=>u?typeof u=="function"?u(w):bi(w):w,b=()=>oi(r[e])?_(r[e]):s,x=w=>{o?o(w)&&v(y,w):v(y,w)};if(d){const w=b(),S=ref$1(w);let T=!1;return watch(()=>r[e],E=>{T||(T=!0,S.value=_(E),nextTick(()=>T=!1))}),watch(S,E=>{!T&&(E!==r[e]||m)&&x(E)},{deep:m}),S}else return computed({get(){return b()},set(w){x(w)}})}function Ua$1(r){return r?r.flatMap(e=>e.type===Fragment?Ua$1(e.children):[e]):[]}function gn(r){if(r===null||typeof r!="object")return!1;const e=Object.getPrototypeOf(r);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in r?!1:Symbol.toStringTag in r?Object.prototype.toString.call(r)==="[object Module]":!0}function Pn(r,e,t=".",n){if(!gn(e))return Pn(r,{},t);const i=Object.assign({},e);for(const a in r){if(a==="__proto__"||a==="constructor")continue;const l=r[a];l!=null&&(Array.isArray(l)&&Array.isArray(i[a])?i[a]=[...l,...i[a]]:gn(l)&&gn(i[a])?i[a]=Pn(l,i[a],(t?`${t}.`:"")+a.toString()):i[a]=l)}return i}function xi(r){return(...e)=>e.reduce((t,n)=>Pn(t,n,""),{})}const Si$1=xi(),[Ga$1,Ei$1]=Q$1("ConfigProvider");let Pi="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Di=(r=21)=>{let e="",t=r;for(;t--;)e+=Pi[Math.random()*64|0];return e};const $i=Sl(()=>{const r=ref$1(new Map),e=ref$1(),t=computed(()=>{for(const l of r.value.values())if(l)return!0;return!1}),n=Ga$1({scrollBody:ref$1(!0)});let i=null;const a=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",Ko$1&&(i==null||i()),e.value=void 0};return watch(t,(l,u)=>{var d;if(!Ye$1)return;if(!l){u&&a();return}e.value===void 0&&(e.value=document.body.style.overflow);const f=window.innerWidth-document.documentElement.clientWidth,m={padding:f,margin:0},s=(d=n.scrollBody)!=null&&d.value?typeof n.scrollBody.value=="object"?Si$1({padding:n.scrollBody.value.padding===!0?f:n.scrollBody.value.padding,margin:n.scrollBody.value.margin===!0?f:n.scrollBody.value.margin},m):m:{padding:0,margin:0};f>0&&(document.body.style.paddingRight=typeof s.padding=="number"?`${s.padding}px`:String(s.padding),document.body.style.marginRight=typeof s.margin=="number"?`${s.margin}px`:String(s.margin),document.body.style.setProperty("--scrollbar-width",`${f}px`),document.body.style.overflow="hidden"),Ko$1&&(i=Le(document,"touchmove",o=>Bi(o),{passive:!1})),nextTick(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),r});function ha(r){const e=Di(6),t=$i();t.value.set(e,r);const n=computed({get:()=>t.value.get(e)??!1,set:i=>t.value.set(e,i)});return fi(()=>{t.value.delete(e)}),n}function Ol(r){const e=window.getComputedStyle(r);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&r.clientWidth1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}function Ae(r){const e=getCurrentInstance(),t=e==null?void 0:e.type.emits,n={};return t!=null&&t.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),t==null||t.forEach(i=>{n[toHandlerKey(camelize(i))]=(...a)=>r(i,...a)}),n}function R(){const r=getCurrentInstance(),e=ref$1(),t=computed(()=>{var l,u;return["#text","#comment"].includes((l=e.value)==null?void 0:l.$el.nodeName)?(u=e.value)==null?void 0:u.$el.nextElementSibling:$e(e)}),n=Object.assign({},r.exposed),i={};for(const l in r.props)Object.defineProperty(i,l,{enumerable:!0,configurable:!0,get:()=>r.props[l]});if(Object.keys(n).length>0)for(const l in n)Object.defineProperty(i,l,{enumerable:!0,configurable:!0,get:()=>n[l]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>r.vnode.el}),r.exposed=i;function a(l){e.value=l,!(l instanceof Element||!l)&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>l.$el}),r.exposed=i)}return{forwardRef:a,currentRef:e,currentElement:t}}var Vi=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},zt=new WeakMap,Pa=new WeakMap,Da$1={},Cn=0,Ml=function(r){return r&&(r.host||Ml(r.parentNode))},Fi$1=function(r,e){return e.map(function(t){if(r.contains(t))return t;var n=Ml(t);return n&&r.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",r,". Doing nothing"),null)}).filter(function(t){return!!t})},Ni=function(r,e,t,n){var i=Fi$1(e,Array.isArray(r)?r:[r]);Da$1[t]||(Da$1[t]=new WeakMap);var a=Da$1[t],l=[],u=new Set,d=new Set(i),f=function(s){!s||u.has(s)||(u.add(s),f(s.parentNode))};i.forEach(f);var m=function(s){!s||d.has(s)||Array.prototype.forEach.call(s.children,function(o){if(u.has(o))m(o);else try{var c=o.getAttribute(n),v=c!==null&&c!=="false",y=(zt.get(o)||0)+1,_=(a.get(o)||0)+1;zt.set(o,y),a.set(o,_),l.push(o),y===1&&v&&Pa.set(o,!0),_===1&&o.setAttribute(t,"true"),v||o.setAttribute(n,"true")}catch(b){console.error("aria-hidden: cannot operate on ",o,b)}})};return m(e),u.clear(),Cn++,function(){l.forEach(function(s){var o=zt.get(s)-1,c=a.get(s)-1;zt.set(s,o),a.set(s,c),o||(Pa.has(s)||s.removeAttribute(n),Pa.delete(s)),c||s.removeAttribute(t)}),Cn--,Cn||(zt=new WeakMap,zt=new WeakMap,Pa=new WeakMap,Da$1={})}},Li=function(r,e,t){t===void 0&&(t="data-aria-hidden");var n=Array.from(Array.isArray(r)?r:[r]),i=Vi(r);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),Ni(n,i,t,"aria-hidden")):function(){return null}};function ya(r){let e;watch(()=>$e(r),t=>{t?e=Li(t):e&&e()}),onUnmounted(()=>{e&&e()})}function he(r,e="radix"){return Ga$1({useId:void 0}),`${e}-${useId()}`}function Fl(r,e){const t=ref$1(r);function n(i){return e[t.value][i]??t.value}return{state:t,dispatch:i=>{t.value=n(i)}}}const Xn=defineComponent({name:"PrimitiveSlot",inheritAttrs:!1,setup(r,{attrs:e,slots:t}){return()=>{var n,i;if(!t.default)return null;const a=Ua$1(t.default()),l=a.findIndex(m=>m.type!==Comment);if(l===-1)return a;const u=a[l];(n=u.props)==null||delete n.ref;const d=u.props?mergeProps(e,u.props):e;e.class&&(i=u.props)!=null&&i.class&&delete u.props.class;const f=cloneVNode(u,d);for(const m in d)m.startsWith("on")&&(f.props||(f.props={}),f.props[m]=d[m]);return a.length===1?f:(a[l]=f,a)}}}),O=defineComponent({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(r,{attrs:e,slots:t}){const n=r.asChild?"template":r.as;return typeof n=="string"&&["area","img","input"].includes(n)?()=>h(n,e):n!=="template"?()=>h(r.as,e,{default:t.default}):()=>h(Xn,e,{default:t.default})}});function Ui(r,e){var t;const n=ref$1({}),i=ref$1("none"),a=ref$1(r),l=r.value?"mounted":"unmounted";let u;const d=((t=e.value)==null?void 0:t.ownerDocument.defaultView)??Tt,{state:f,dispatch:m}=Fl(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),s=_=>{var b;if(Ye$1){const x=new CustomEvent(_,{bubbles:!1,cancelable:!1});(b=e.value)==null||b.dispatchEvent(x)}};watch(r,async(_,b)=>{var x;const w=b!==_;if(await nextTick(),w){const S=i.value,T=$a(e.value);_?(m("MOUNT"),s("enter"),T==="none"&&s("after-enter")):T==="none"||((x=n.value)==null?void 0:x.display)==="none"?(m("UNMOUNT"),s("leave"),s("after-leave")):b&&S!==T?(m("ANIMATION_OUT"),s("leave")):(m("UNMOUNT"),s("after-leave"))}},{immediate:!0});const o=_=>{const b=$a(e.value),x=b.includes(_.animationName),w=f.value==="mounted"?"enter":"leave";if(_.target===e.value&&x&&(s(`after-${w}`),m("ANIMATION_END"),!a.value)){const S=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",u=d==null?void 0:d.setTimeout(()=>{var T;((T=e.value)==null?void 0:T.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=S)})}_.target===e.value&&b==="none"&&m("ANIMATION_END")},c=_=>{_.target===e.value&&(i.value=$a(e.value))},v=watch(e,(_,b)=>{_?(n.value=getComputedStyle(_),_.addEventListener("animationstart",c),_.addEventListener("animationcancel",o),_.addEventListener("animationend",o)):(m("ANIMATION_END"),d==null||d.clearTimeout(u),b==null||b.removeEventListener("animationstart",c),b==null||b.removeEventListener("animationcancel",o),b==null||b.removeEventListener("animationend",o))},{immediate:!0}),y=watch(f,()=>{const _=$a(e.value);i.value=f.value==="mounted"?_:"none"});return onUnmounted(()=>{v(),y()}),{isPresent:computed(()=>["mounted","unmountSuspended"].includes(f.value))}}function $a(r){return r&&getComputedStyle(r).animationName||"none"}const Pe$1=defineComponent({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(r,{slots:e,expose:t}){var n;const{present:i,forceMount:a}=toRefs(r),l=ref$1(),{isPresent:u}=Ui(i,l);t({present:u});let d=e.default({present:u});d=Ua$1(d||[]);const f=getCurrentInstance();if(d&&(d==null?void 0:d.length)>1){const m=(n=f==null?void 0:f.parent)!=null&&n.type.name?`<${f.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${m}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(s=>` - ${s}`).join(` -`)].join(` -`))}return()=>a.value||i.value||u.value?h(e.default({present:u})[0],{ref:m=>{const s=$e(m);return typeof(s==null?void 0:s.hasAttribute)>"u"||(s!=null&&s.hasAttribute("data-radix-popper-content-wrapper")?l.value=s.firstElementChild:l.value=s),s}}):null}}),[tt$1,Ji]=Q$1("DialogRoot"),Qi=defineComponent({inheritAttrs:!1,__name:"DialogRoot",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:open"],setup(r,{emit:e}){const t=r,n=ne$1(t,"open",e,{defaultValue:t.defaultOpen,passive:t.open===void 0}),i=ref$1(),a=ref$1(),{modal:l}=toRefs(t);return Ji({open:n,modal:l,openModal:()=>{n.value=!0},onOpenChange:u=>{n.value=u},onOpenToggle:()=>{n.value=!n.value},contentId:"",titleId:"",descriptionId:"",triggerElement:i,contentElement:a}),(u,d)=>renderSlot(u.$slots,"default",{open:unref(n)})}}),eu=defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(r){const e=r,t=tt$1(),{forwardRef:n,currentElement:i}=R();return t.contentId||(t.contentId=he(void 0,"radix-vue-dialog-content")),onMounted(()=>{t.triggerElement.value=i.value}),(a,l)=>(openBlock(),createBlock(unref(O),mergeProps(e,{ref:unref(n),type:a.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":unref(t).open.value||!1,"aria-controls":unref(t).open.value?unref(t).contentId:void 0,"data-state":unref(t).open.value?"open":"closed",onClick:unref(t).onOpenToggle}),{default:withCtx(()=>[renderSlot(a.$slots,"default")]),_:3},16,["type","aria-expanded","aria-controls","data-state","onClick"]))}}),ot$1=defineComponent({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=ja$1();return(t,n)=>unref(e)||t.forceMount?(openBlock(),createBlock(Teleport,{key:0,to:t.to,disabled:t.disabled},[renderSlot(t.$slots,"default")],8,["to","disabled"])):createCommentVNode("",!0)}}),Pv=defineComponent({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=r;return(t,n)=>(openBlock(),createBlock(unref(ot$1),normalizeProps(guardReactiveProps(e)),{default:withCtx(()=>[renderSlot(t.$slots,"default")]),_:3},16))}}),tu="dismissableLayer.pointerDownOutside",au="dismissableLayer.focusOutside";function Kl(r,e){const t=e.closest("[data-dismissable-layer]"),n=r.dataset.dismissableLayer===""?r:r.querySelector("[data-dismissable-layer]"),i=Array.from(r.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(t&&n===t||i.indexOf(n){});return watchEffect(l=>{if(!Ye$1)return;const u=async f=>{const m=f.target;if(e!=null&&e.value){if(Kl(e.value,m)){i.value=!1;return}if(f.target&&!i.value){let s=function(){Wt(tu,r,o)};const o={originalEvent:f};f.pointerType==="touch"?(n.removeEventListener("click",a.value),a.value=s,n.addEventListener("click",a.value,{once:!0})):s()}else n.removeEventListener("click",a.value);i.value=!1}},d=window.setTimeout(()=>{n.addEventListener("pointerdown",u)},0);l(()=>{window.clearTimeout(d),n.removeEventListener("pointerdown",u),n.removeEventListener("click",a.value)})}),{onPointerDownCapture:()=>i.value=!0}}function Wl(r,e){var t;const n=((t=e==null?void 0:e.value)==null?void 0:t.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=ref$1(!1);return watchEffect(a=>{if(!Ye$1)return;const l=async u=>{e!=null&&e.value&&(await nextTick(),!(!e.value||Kl(e.value,u.target))&&u.target&&!i.value&&Wt(au,r,{originalEvent:u}))};n.addEventListener("focusin",l),a(()=>n.removeEventListener("focusin",l))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const je=reactive({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gt$1=defineComponent({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(r,{emit:e}){const t=r,n=e,{forwardRef:i,currentElement:a}=R(),l=computed(()=>{var v;return((v=a.value)==null?void 0:v.ownerDocument)??globalThis.document}),u=computed(()=>je.layersRoot),d=computed(()=>a.value?Array.from(u.value).indexOf(a.value):-1),f=computed(()=>je.layersWithOutsidePointerEventsDisabled.size>0),m=computed(()=>{const v=Array.from(u.value),[y]=[...je.layersWithOutsidePointerEventsDisabled].slice(-1),_=v.indexOf(y);return d.value>=_}),s=Hl(async v=>{const y=[...je.branches].some(_=>_==null?void 0:_.contains(v.target));!m.value||y||(n("pointerDownOutside",v),n("interactOutside",v),await nextTick(),v.defaultPrevented||n("dismiss"))},a),o=Wl(v=>{[...je.branches].some(y=>y==null?void 0:y.contains(v.target))||(n("focusOutside",v),n("interactOutside",v),v.defaultPrevented||n("dismiss"))},a);jn("Escape",v=>{d.value===u.value.size-1&&(n("escapeKeyDown",v),v.defaultPrevented||n("dismiss"))});let c;return watchEffect(v=>{a.value&&(t.disableOutsidePointerEvents&&(je.layersWithOutsidePointerEventsDisabled.size===0&&(c=l.value.body.style.pointerEvents,l.value.body.style.pointerEvents="none"),je.layersWithOutsidePointerEventsDisabled.add(a.value)),u.value.add(a.value),v(()=>{t.disableOutsidePointerEvents&&je.layersWithOutsidePointerEventsDisabled.size===1&&(l.value.body.style.pointerEvents=c)}))}),watchEffect(v=>{v(()=>{a.value&&(u.value.delete(a.value),je.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(v,y)=>(openBlock(),createBlock(unref(O),{ref:unref(i),"as-child":v.asChild,as:v.as,"data-dismissable-layer":"",style:normalizeStyle({pointerEvents:f.value?m.value?"auto":"none":void 0}),onFocusCapture:unref(o).onFocusCapture,onBlurCapture:unref(o).onBlurCapture,onPointerdownCapture:unref(s).onPointerDownCapture},{default:withCtx(()=>[renderSlot(v.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),wn="focusScope.autoFocusOnMount",_n="focusScope.autoFocusOnUnmount",jo={bubbles:!1,cancelable:!0};function Oa(r,{select:e=!1}={}){const t=document.activeElement;for(const n of r)if(ct$1(n,{select:e}),document.activeElement!==t)return!0}function ou(r){const e=Jn(r),t=Uo(e,r),n=Uo(e.reverse(),r);return[t,n]}function Jn(r){const e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function Uo(r,e){for(const t of r)if(!lu(t,{upTo:e}))return t}function lu(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function su(r){return r instanceof HTMLInputElement&&"select"in r}function ct$1(r,{select:e=!1}={}){if(r&&r.focus){const t=document.activeElement;r.focus({preventScroll:!0}),r!==t&&su(r)&&e&&r.select()}}const ru=ai(()=>ref$1([]));function iu(){const r=ru();return{add(e){const t=r.value[0];e!==t&&(t==null||t.pause()),r.value=Go(r.value,e),r.value.unshift(e)},remove(e){var t;r.value=Go(r.value,e),(t=r.value[0])==null||t.resume()}}}function Go(r,e){const t=[...r],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function uu(r){return r.filter(e=>e.tagName!=="A")}const Ya$1=defineComponent({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(r,{emit:e}){const t=r,n=e,{currentRef:i,currentElement:a}=R(),l=ref$1(null),u=iu(),d=reactive({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});watchEffect(m=>{if(!Ye$1)return;const s=a.value;if(!t.trapped)return;function o(_){if(d.paused||!s)return;const b=_.target;s.contains(b)?l.value=b:ct$1(l.value,{select:!0})}function c(_){if(d.paused||!s)return;const b=_.relatedTarget;b!==null&&(s.contains(b)||ct$1(l.value,{select:!0}))}function v(_){s.contains(l.value)||ct$1(s)}document.addEventListener("focusin",o),document.addEventListener("focusout",c);const y=new MutationObserver(v);s&&y.observe(s,{childList:!0,subtree:!0}),m(()=>{document.removeEventListener("focusin",o),document.removeEventListener("focusout",c),y.disconnect()})}),watchEffect(async m=>{const s=a.value;if(await nextTick(),!s)return;u.add(d);const o=document.activeElement;if(!s.contains(o)){const c=new CustomEvent(wn,jo);s.addEventListener(wn,v=>n("mountAutoFocus",v)),s.dispatchEvent(c),c.defaultPrevented||(Oa(uu(Jn(s)),{select:!0}),document.activeElement===o&&ct$1(s))}m(()=>{s.removeEventListener(wn,y=>n("mountAutoFocus",y));const c=new CustomEvent(_n,jo),v=y=>{n("unmountAutoFocus",y)};s.addEventListener(_n,v),s.dispatchEvent(c),setTimeout(()=>{c.defaultPrevented||ct$1(o??document.body,{select:!0}),s.removeEventListener(_n,v),u.remove(d)},0)})});function f(m){if(!t.loop&&!t.trapped||d.paused)return;const s=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,o=document.activeElement;if(s&&o){const c=m.currentTarget,[v,y]=ou(c);v&&y?!m.shiftKey&&o===y?(m.preventDefault(),t.loop&&ct$1(v,{select:!0})):m.shiftKey&&o===v&&(m.preventDefault(),t.loop&&ct$1(y,{select:!0})):o===c&&m.preventDefault()}}return(m,s)=>(openBlock(),createBlock(unref(O),{ref_key:"currentRef",ref:i,tabindex:"-1","as-child":m.asChild,as:m.as,onKeydown:f},{default:withCtx(()=>[renderSlot(m.$slots,"default")]),_:3},8,["as-child","as"]))}});function Qn(r){return r?"open":"closed"}const Ul=defineComponent({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=tt$1(),{forwardRef:a,currentElement:l}=R();return i.titleId||(i.titleId=he(void 0,"radix-vue-dialog-title")),i.descriptionId||(i.descriptionId=he(void 0,"radix-vue-dialog-description")),onMounted(()=>{i.contentElement=l,document.activeElement!==document.body&&(i.triggerElement.value=document.activeElement)}),(u,d)=>(openBlock(),createBlock(unref(Ya$1),{"as-child":"",loop:"",trapped:t.trapFocus,onMountAutoFocus:d[5]||(d[5]=f=>n("openAutoFocus",f)),onUnmountAutoFocus:d[6]||(d[6]=f=>n("closeAutoFocus",f))},{default:withCtx(()=>[createVNode(unref(gt$1),mergeProps({id:unref(i).contentId,ref:unref(a),as:u.as,"as-child":u.asChild,"disable-outside-pointer-events":u.disableOutsidePointerEvents,role:"dialog","aria-describedby":unref(i).descriptionId,"aria-labelledby":unref(i).titleId,"data-state":unref(Qn)(unref(i).open.value)},u.$attrs,{onDismiss:d[0]||(d[0]=f=>unref(i).onOpenChange(!1)),onEscapeKeyDown:d[1]||(d[1]=f=>n("escapeKeyDown",f)),onFocusOutside:d[2]||(d[2]=f=>n("focusOutside",f)),onInteractOutside:d[3]||(d[3]=f=>n("interactOutside",f)),onPointerDownOutside:d[4]||(d[4]=f=>n("pointerDownOutside",f))}),{default:withCtx(()=>[renderSlot(u.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),Cu$1=defineComponent({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=tt$1(),a=Ae(n),{forwardRef:l,currentElement:u}=R();return ya(u),(d,f)=>(openBlock(),createBlock(Ul,mergeProps({...t,...unref(a)},{ref:unref(l),"trap-focus":unref(i).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:f[0]||(f[0]=m=>{var s;m.defaultPrevented||(m.preventDefault(),(s=unref(i).triggerElement.value)==null||s.focus())}),onPointerDownOutside:f[1]||(f[1]=m=>{const s=m.detail.originalEvent,o=s.button===0&&s.ctrlKey===!0;(s.button===2||o)&&m.preventDefault()}),onFocusOutside:f[2]||(f[2]=m=>{m.preventDefault()})}),{default:withCtx(()=>[renderSlot(d.$slots,"default")]),_:3},16,["trap-focus"]))}}),wu=defineComponent({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=Ae(e);R();const i=tt$1(),a=ref$1(!1),l=ref$1(!1);return(u,d)=>(openBlock(),createBlock(Ul,mergeProps({...t,...unref(n)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:d[0]||(d[0]=f=>{var m;f.defaultPrevented||(a.value||(m=unref(i).triggerElement.value)==null||m.focus(),f.preventDefault()),a.value=!1,l.value=!1}),onInteractOutside:d[1]||(d[1]=f=>{var m;f.defaultPrevented||(a.value=!0,f.detail.originalEvent.type==="pointerdown"&&(l.value=!0));const s=f.target;(m=unref(i).triggerElement.value)!=null&&m.contains(s)&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&l.value&&f.preventDefault()})}),{default:withCtx(()=>[renderSlot(u.$slots,"default")]),_:3},16))}}),_u=defineComponent({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=tt$1(),a=Ae(n),{forwardRef:l}=R();return(u,d)=>(openBlock(),createBlock(unref(Pe$1),{present:u.forceMount||unref(i).open.value},{default:withCtx(()=>[unref(i).modal.value?(openBlock(),createBlock(Cu$1,mergeProps({key:0,ref:unref(l)},{...t,...unref(a),...u.$attrs}),{default:withCtx(()=>[renderSlot(u.$slots,"default")]),_:3},16)):(openBlock(),createBlock(wu,mergeProps({key:1,ref:unref(l)},{...t,...unref(a),...u.$attrs}),{default:withCtx(()=>[renderSlot(u.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),xu=defineComponent({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean},as:{}},setup(r){const e=tt$1();return ha(!0),R(),(t,n)=>(openBlock(),createBlock(unref(O),{as:t.as,"as-child":t.asChild,"data-state":unref(e).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:withCtx(()=>[renderSlot(t.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),Su$1=defineComponent({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(r){const e=tt$1(),{forwardRef:t}=R();return(n,i)=>{var a;return(a=unref(e))!=null&&a.modal.value?(openBlock(),createBlock(unref(Pe$1),{key:0,present:n.forceMount||unref(e).open.value},{default:withCtx(()=>[createVNode(xu,mergeProps(n.$attrs,{ref:unref(t),as:n.as,"as-child":n.asChild}),{default:withCtx(()=>[renderSlot(n.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):createCommentVNode("",!0)}}});function bf(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}bf();(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top],.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left],.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height, 0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]:after{content:"";position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]:after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]:after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]:after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]:after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@keyframes fake-animation{}@media (hover: hover) and (pointer: fine){[vaul-drawer]{-webkit-user-select:none;user-select:none}}')),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const Fe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const et=r=>typeof r<"u";function tt(r){return JSON.parse(JSON.stringify(r))}function ye(r,e,t,n={}){var i,a,l;const{clone:u=!1,passive:d=!1,eventName:f,deep:m=!1,defaultValue:s,shouldEmit:o}=n,c=getCurrentInstance(),v=t||(c==null?void 0:c.emit)||((i=c==null?void 0:c.$emit)==null?void 0:i.bind(c))||((l=(a=c==null?void 0:c.proxy)==null?void 0:a.$emit)==null?void 0:l.bind(c==null?void 0:c.proxy));let y=f;e||(e="modelValue"),y=y||`update:${e.toString()}`;const _=w=>u?typeof u=="function"?u(w):tt(w):w,b=()=>et(r[e])?_(r[e]):s,x=w=>{o?o(w)&&v(y,w):v(y,w)};if(d){const w=b(),S=ref$1(w);let T=!1;return watch(()=>r[e],E=>{T||(T=!0,S.value=_(E),nextTick(()=>T=!1))}),watch(S,E=>{!T&&(E!==r[e]||m)&&x(E)},{deep:m}),S}else return computed({get(){return b()},set(w){x(w)}})}const[ve,nt]=Q$1("DrawerRoot"),Pe=new WeakMap;function $(r,e,t=!1){if(!r||!(r instanceof HTMLElement)||!e)return;const n={};Object.entries(e).forEach(([i,a])=>{if(i.startsWith("--")){r.style.setProperty(i,a);return}n[i]=r.style[i],r.style[i]=a}),!t&&Pe.set(r,n)}function ne(r,e){if(!r||!(r instanceof HTMLElement))return;const t=Pe.get(r);t&&(e?r.style[e]=t[e]:Object.entries(t).forEach(([n,i])=>{r.style[n]=i}))}function ae(r,e){const t=window.getComputedStyle(r),n=t.transform||t.webkitTransform||t.mozTransform;let i=n.match(/^matrix3d\((.+)\)$/);return i?Number.parseFloat(i[1].split(", ")[N(e)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?Number.parseFloat(i[1].split(", ")[N(e)?5:4]):null)}function at(r){return 8*(Math.log(r+1)-2)}function N(r){switch(r){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return r}}const g={DURATION:.5,EASE:[.32,.72,0,1]},Re=.4;function lt$1({activeSnapPoint:r,snapPoints:e,drawerRef:t,overlayRef:n,fadeFromIndex:i,onSnapPointChange:a,direction:l}){const u=computed(()=>(e.value&&r.value===e.value[e.value.length-1])??null),d=computed(()=>e.value&&e.value.length>0&&((i==null?void 0:i.value)||(i==null?void 0:i.value)===0)&&!Number.isNaN(i==null?void 0:i.value)&&e.value[(i==null?void 0:i.value)??-1]===r.value||!e.value),f=computed(()=>{var _;return((_=e.value)==null?void 0:_.findIndex(b=>b===r.value))??null}),m=computed(()=>{var _;return((_=e.value)==null?void 0:_.map(b=>{const x=typeof window<"u",w=typeof b=="string";let S=0;if(w&&(S=Number.parseInt(b,10)),N(l.value)){const E=w?S:x?b*window.innerHeight:0;return x?l.value==="bottom"?window.innerHeight-E:-window.innerHeight+E:E}const T=w?S:x?b*window.innerWidth:0;return x?l.value==="right"?window.innerWidth-T:-window.innerWidth+T:T}))??[]}),s=computed(()=>{var _;return f.value!==null?(_=m.value)==null?void 0:_[f.value]:null}),o=_=>{var b,x,w,S;const T=((b=m.value)==null?void 0:b.findIndex(E=>E===_))??null;nextTick(()=>{var E;a(T,m.value),$((E=t.value)==null?void 0:E.$el,{transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,transform:N(l.value)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}),m.value&&T!==m.value.length-1&&T!==(i==null?void 0:i.value)?$((x=n.value)==null?void 0:x.$el,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,opacity:"0"}):$((w=n.value)==null?void 0:w.$el,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,opacity:"1"}),r.value=T!==null?((S=e.value)==null?void 0:S[T])??null:null};watch([r,m,e],()=>{var _;if(r.value){const b=((_=e.value)==null?void 0:_.findIndex(x=>x===r.value))??-1;m.value&&b!==-1&&typeof m.value[b]=="number"&&o(m.value[b])}},{immediate:!0});function c({draggedDistance:_,closeDrawer:b,velocity:x,dismissible:w}){var S,T,E;if(i===void 0)return;const M=l.value==="bottom"||l.value==="right"?(s.value??0)-_:(s.value??0)+_,P=f.value===(i.value??0)-1,A=f.value===0,C=_>0;if(P&&$((S=n.value)==null?void 0:S.$el,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),x>2&&!C){w?b():o(m.value[0]);return}if(x>2&&C&&m&&e.value){o(m.value[e.value.length-1]);return}const D=(T=m.value)==null?void 0:T.reduce((j,I)=>typeof j!="number"||typeof I!="number"?j:Math.abs(I-M)Re&&Math.abs(_)0&&u){o(m.value[(((E=e.value)==null?void 0:E.length)??0)-1]);return}if(A&&j<0&&w&&b(),f.value===null)return;o(m.value[f.value+j]);return}o(D)}function v({draggedDistance:_}){var b;if(s.value===null)return;const x=l.value==="bottom"||l.value==="right"?(s.value??0)-_:(s.value??0)+_;(l.value==="bottom"||l.value==="right")&&xm.value[m.value.length-1]||$((b=t.value)==null?void 0:b.$el,{transform:N(l.value)?`translate3d(0, ${x}px, 0)`:`translate3d(${x}px, 0, 0)`})}function y(_,b){if(!e||typeof f.value!="number"||!m.value||i===void 0)return null;const x=f.value===(i.value??0)-1;if(f.value>=(i.value??0)&&b)return 0;if(x&&!b)return 1;if(!d.value&&!x)return null;const w=x?f.value+1:f.value-1,S=x?m.value[w]-m.value[w-1]:m.value[w+1]-m.value[w],T=_/Math.abs(S);return x?1-T:T}return{isLastSnapPoint:u,shouldFade:d,getPercentageDragged:y,activeSnapPointIndex:f,onRelease:c,onDrag:v,snapPointsOffset:m}}let Q=null;function ot(r){const{isOpen:e,modal:t,nested:n,hasBeenOpened:i}=r,a=ref$1(typeof window<"u"?window.location.href:""),l=ref$1(0);function u(){if(Q===null&&e.value){Q={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};const{scrollX:f,innerHeight:m}=window;document.body.style.position="fixed",document.body.style.top=`-${l.value}px`,document.body.style.left=`-${f}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>{requestAnimationFrame(()=>{const s=m-window.innerHeight;s&&l.value>=m&&(document.body.style.top=`-${l.value+s}px`)})},300)}}function d(){if(Q!==null){const f=-Number.parseInt(document.body.style.top,10),m=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,Q),requestAnimationFrame(()=>{if(a.value!==window.location.href){a.value=window.location.href;return}window.scrollTo(m,f)}),Q=null}}return onMounted(()=>{function f(){l.value=window.scrollY}f(),window.addEventListener("scroll",f),onUnmounted(()=>{window.removeEventListener("scroll",f)})}),watch([e,i,a],()=>{n.value||!i.value||(e.value?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t.value||setTimeout(()=>{d()},500)):d())}),{restorePositionSetting:d}}const it=.25,rt=100,De=8,q=16,ut$1=26,Se="vaul-dragging";function st(r,e){return r&&r.value?r:e}function ct(r){const{emitDrag:e,emitRelease:t,emitClose:n,emitOpenChange:i,open:a,dismissible:l,nested:u,fixed:d,modal:f,shouldScaleBackground:m,scrollLockTimeout:s,closeThreshold:o,activeSnapPoint:c,fadeFromIndex:v,direction:y}=r,_=ref$1(a.value??!1),b=ref$1(!1),x=ref$1(!1),w=ref$1(!1),S=ref$1(!1),T=ref$1(null),E=ref$1(null),M=ref$1(null),P=ref$1(null),A=ref$1(null),C=ref$1(!0),D=ref$1(null),k=ref$1(0),j=ref$1(!1);ref$1(0);const I=ref$1(null);ref$1(0);const W=computed(()=>{var le;return((le=I.value)==null?void 0:le.$el.getBoundingClientRect().height)||0}),L=st(r.snapPoints,ref$1(void 0)),{activeSnapPointIndex:U,onRelease:H,snapPointsOffset:Y,onDrag:B,shouldFade:X,getPercentageDragged:Z}=lt$1({snapPoints:L,activeSnapPoint:c,drawerRef:I,fadeFromIndex:v,overlayRef:T,onSnapPointChange:z,direction:y});function z(le,te){L.value&&le===te.length-1&&(E.value=new Date)}const{restorePositionSetting:_e}=ot({isOpen:_,modal:f,nested:u,hasBeenOpened:b});function fe(){return(window.innerWidth-ut$1)/window.innerWidth}function We(le,te){var oe;if(!le)return!1;let pe=le;const Be=(oe=window.getSelection())==null?void 0:oe.toString(),ze=I.value?ae(I.value.$el,y.value):null,be=new Date;if(pe.hasAttribute("data-vaul-no-drag")||pe.closest("[data-vaul-no-drag]"))return!1;if(y.value==="right"||y.value==="left")return!0;if(E.value&&be.getTime()-E.value.getTime()<500)return!1;if(ze!==null&&(y.value==="bottom"?ze>0:ze<0))return!0;if(Be&&Be.length>0)return!1;if(A.value&&be.getTime()-A.value.getTime()pe.clientHeight){if(pe.scrollTop!==0)return A.value=new Date,!1;if(pe.getAttribute("role")==="dialog")return!0}pe=pe.parentNode}return!0}function ft(le){!l.value&&!L.value||I.value&&!I.value.$el.contains(le.target)||(w.value=!0,M.value=new Date,le.target.setPointerCapture(le.pointerId),k.value=N(y.value)?le.clientY:le.clientX)}function Te(le){var te,oe,pe,Be,ze,be;if(I.value&&w.value){const pt=y.value==="bottom"||y.value==="right"?1:-1,Et=(k.value-(N(y.value)?le.clientY:le.clientX))*pt,Xe=Et>0,Ce=L.value&&!l.value&&!Xe;if(Ce&&U.value===0)return;const bt=Math.abs(Et),xt=document.querySelector("[vaul-drawer-wrapper]");let Pt=bt/W.value;const Nt=Z(bt,Xe);if(Nt!==null&&(Pt=Nt),Ce&&Pt>=1||!C.value&&!We(le.target,Xe))return;if((te=I==null?void 0:I.value)==null||te.$el.classList.add(Se),C.value=!0,$((oe=I.value)==null?void 0:oe.$el,{transition:"none"}),$((pe=T.value)==null?void 0:pe.$el,{transition:"none"}),L.value&&B({draggedDistance:Et}),Xe&&!L.value){const Vt=at(Et),$t=Math.min(Vt*-1,0)*pt;$((Be=I.value)==null?void 0:Be.$el,{transform:N(y.value)?`translate3d(0, ${$t}px, 0)`:`translate3d(${$t}px, 0, 0)`});return}const Yt=1-Pt;if((X.value||v.value&&U.value===v.value-1)&&(e(Pt),$((ze=T.value)==null?void 0:ze.$el,{opacity:`${Yt}`,transition:"none"},!0)),xt&&T.value&&m.value){const Vt=Math.min(fe()+Pt*(1-fe()),1),$t=8-Pt*8,Rt=Math.max(0,14-Pt*14);$(xt,{borderRadius:`${$t}px`,transform:N(y.value)?`scale(${Vt}) translate3d(0, ${Rt}px, 0)`:`scale(${Vt}) translate3d(${Rt}px, 0, 0)`,transition:"none"},!0)}if(!L.value){const Vt=bt*pt;$((be=I.value)==null?void 0:be.$el,{transform:N(y.value)?`translate3d(0, ${Vt}px, 0)`:`translate3d(${Vt}px, 0, 0)`})}}}function G(){var le;if(!I.value)return;const te=document.querySelector("[vaul-drawer-wrapper]"),oe=ae(I.value.$el,y.value);$(I.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),$((le=T.value)==null?void 0:le.$el,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,opacity:"1"}),m.value&&oe&&oe>0&&_.value&&$(te,{borderRadius:`${De}px`,overflow:"hidden",...N(y.value)?{transform:`scale(${fe()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${fe()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${g.DURATION}s`,transitionTimingFunction:`cubic-bezier(${g.EASE.join(",")})`},!0)}function K(){var le;I.value&&($(I.value.$el,{transform:N(y.value)?`translate3d(0, ${y.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${y.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),$((le=T.value)==null?void 0:le.$el,{opacity:"0",transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),ke(!1),window.setTimeout(()=>{x.value=!1,_.value=!1},300),window.setTimeout(()=>{L.value&&(c.value=L.value[0])},g.DURATION*1e3))}watchEffect(()=>{if(!_.value&&m.value&&Fe){const le=setTimeout(()=>{ne(document.body)},200);return()=>clearTimeout(le)}}),onUnmounted(()=>{ke(!1),_e()});function ue(le){if(!w.value||!I.value)return;I.value.$el.classList.remove(Se),C.value=!1,w.value=!1,P.value=new Date;const te=ae(I.value.$el,y.value);if(!We(le.target,!1)||!te||Number.isNaN(te)||M.value===null)return;const oe=P.value.getTime()-M.value.getTime(),pe=k.value-(N(y.value)?le.clientY:le.clientX),Be=Math.abs(pe)/oe;if(Be>.05&&(S.value=!0,window.setTimeout(()=>{S.value=!1},200)),L.value){const be=y.value==="bottom"||y.value==="right"?1:-1;H({draggedDistance:pe*be,closeDrawer:K,velocity:Be,dismissible:l.value}),t(!0);return}if(y.value==="bottom"||y.value==="right"?pe>0:pe<0){G(),t(!0);return}if(Be>Re){K(),t(!1);return}const ze=Math.min(I.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(te>=ze*o.value){K(),t(!1);return}t(!0),G()}watch(_,le=>{le&&(E.value=new Date,ke(!0)),i(le)},{immediate:!0}),watch(a,le=>{le?(_.value=le,b.value=!0):K()},{immediate:!0});function ke(le){const te=document.querySelector("[vaul-drawer-wrapper]");!te||!m.value||(le?($(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),$(document.body,{background:"black"},!0),$(te,{borderRadius:`${De}px`,overflow:"hidden",...N(y.value)?{transform:`scale(${fe()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${fe()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${g.DURATION}s`,transitionTimingFunction:`cubic-bezier(${g.EASE.join(",")})`})):(ne(te,"overflow"),ne(te,"transform"),ne(te,"borderRadius"),$(te,{transitionProperty:"transform, border-radius",transitionDuration:`${g.DURATION}s`,transitionTimingFunction:`cubic-bezier(${g.EASE.join(",")})`})))}function Ie(le){var te,oe;const pe=le?(window.innerWidth-q)/window.innerWidth:1,Be=le?-q:0;D.value&&window.clearTimeout(D.value),$((te=I.value)==null?void 0:te.$el,{transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,transform:`scale(${pe}) translate3d(0, ${Be}px, 0)`}),!le&&(oe=I.value)!=null&&oe.$el&&(D.value=window.setTimeout(()=>{var ze,be;const pt=ae((ze=I.value)==null?void 0:ze.$el,y.value);$((be=I.value)==null?void 0:be.$el,{transition:"none",transform:N(y.value)?`translate3d(0, ${pt}px, 0)`:`translate3d(${pt}px, 0, 0)`})},500))}function F(le){var te;if(le<0)return;const oe=N(y.value)?window.innerHeight:window.innerWidth,pe=(oe-q)/oe,Be=pe+le*(1-pe),ze=-q+le*q;$((te=I.value)==null?void 0:te.$el,{transform:N(y.value)?`scale(${Be}) translate3d(0, ${ze}px, 0)`:`scale(${Be}) translate3d(${ze}px, 0, 0)`,transition:"none"})}function ge(le){var te;const oe=N(y.value)?window.innerHeight:window.innerWidth,pe=le?(oe-q)/oe:1,Be=le?-q:0;le&&$((te=I.value)==null?void 0:te.$el,{transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,transform:N(y.value)?`scale(${pe}) translate3d(0, ${Be}px, 0)`:`scale(${pe}) translate3d(${Be}px, 0, 0)`})}return{open:a,isOpen:_,modal:f,keyboardIsOpen:j,hasBeenOpened:b,isVisible:x,drawerRef:I,drawerHeightRef:W,overlayRef:T,isDragging:w,dragStartTime:M,isAllowedToDrag:C,snapPoints:L,activeSnapPoint:c,pointerStart:k,dismissible:l,snapPointsOffset:Y,direction:y,shouldFade:X,fadeFromIndex:v,shouldScaleBackground:m,onPress:ft,onDrag:Te,onRelease:ue,closeDrawer:K,onNestedDrag:F,onNestedRelease:ge,onNestedOpenChange:Ie,emitClose:n,emitDrag:e,emitRelease:t,emitOpenChange:i,nested:u}}const vt=defineComponent({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:it},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:rt},fixed:{type:Boolean,default:void 0},dismissible:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},nested:{type:Boolean,default:!1},direction:{default:"bottom"},snapPoints:{default:void 0},fadeFromIndex:{default:void 0}},emits:["drag","release","close","update:open","update:activeSnapPoint"],setup(r,{expose:e,emit:t}){const n=r,i=t;useSlots();const a=computed(()=>n.fadeFromIndex??(n.snapPoints&&n.snapPoints.length-1)),l=ye(n,"open",i,{defaultValue:n.defaultOpen,passive:n.open===void 0}),u=ye(n,"activeSnapPoint",i,{passive:n.activeSnapPoint===void 0}),d={emitDrag:v=>i("drag",v),emitRelease:v=>i("release",v),emitClose:()=>i("close"),emitOpenChange:v=>{i("update:open",v)}},{closeDrawer:f,hasBeenOpened:m,modal:s,isOpen:o}=nt(ct({...d,...toRefs(n),activeSnapPoint:u,fadeFromIndex:a,open:l}));function c(v){if(l.value!==void 0){d.emitOpenChange(v);return}v?(m.value=!0,o.value=v):f()}return e({open:o}),(v,y)=>(openBlock(),createBlock(unref(Qi),{open:unref(o),modal:unref(s),"onUpdate:open":c},{default:withCtx(()=>[renderSlot(v.$slots,"default",{open:unref(o)})]),_:3},8,["open","modal"]))}}),mt=defineComponent({__name:"DrawerOverlay",setup(r){const{overlayRef:e,snapPoints:t,isVisible:n,isOpen:i,shouldFade:a}=ve(),l=computed(()=>{var u;return t&&(((u=t.value)==null?void 0:u.length)??0)>0});return(u,d)=>(openBlock(),createBlock(unref(Su$1),{ref_key:"overlayRef",ref:e,"vaul-drawer-visible":unref(n)?"true":"false","vaul-overlay":"","vaul-snap-points":unref(i)&&l.value?"true":"false","vaul-snap-points-overlay":unref(i)&&unref(a)?"true":"false"},null,8,["vaul-drawer-visible","vaul-snap-points","vaul-snap-points-overlay"]))}}),gt=defineComponent({__name:"DrawerContent",setup(r){const{open:e,isOpen:t,isVisible:n,snapPointsOffset:i,drawerRef:a,onPress:l,onDrag:u,onRelease:d,modal:f,emitOpenChange:m,dismissible:s,keyboardIsOpen:o,closeDrawer:c,direction:v}=ve(),y=computed(()=>i.value&&i.value.length>0?`${i.value[0]}px`:"0");function _(b){if(!f.value||b.defaultPrevented){b.preventDefault();return}o.value&&(o.value=!1),b.preventDefault(),s.value&&m(!1),!(!s.value||e.value!==void 0)&&c()}return watch(t,b=>{b&&setTimeout(()=>{n.value=!0},1)},{immediate:!0}),(b,x)=>(openBlock(),createBlock(unref(_u),{ref_key:"drawerRef",ref:a,"vaul-drawer":"","vaul-drawer-direction":unref(v),"vaul-drawer-visible":unref(n)?"true":"false",style:normalizeStyle({"--snap-point-height":y.value}),onPointerdown:unref(l),onPointermove:unref(u),onPointerup:unref(d),onPointerDownOutside:_,onEscapeKeyDown:x[0]||(x[0]=w=>{unref(s)||w.preventDefault()})},{default:withCtx(()=>[renderSlot(b.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),_hoisted_1$7={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},_hoisted_2$7={key:0,flex:"",mr:"12"},_hoisted_3$6={flex:"~ col",border:"4 solid pink-200/50 dark:pink-500/50",shadow:"md pink-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {nextTick().then(()=>{n.update(),i.value=n.height.value})}),u(async()=>{nextTick().then(()=>{n.update(),i.value=n.height.value})}),(d,f)=>{const m=resolveDirective("auto-animate");return openBlock(),createElementBlock("div",_hoisted_1$7,[f[3]||(f[3]=createBaseVNode("div",{"flex-1":""},null,-1)),withDirectives((openBlock(),createElementBlock("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[f[2]||(f[2]=createBaseVNode("div",{"flex-1":""},null,-1)),(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(t),(s,o)=>(openBlock(),createElementBlock("div",{key:o,"mb-2":""},[s.role==="assistant"?(openBlock(),createElementBlock("div",_hoisted_2$7,[createBaseVNode("div",_hoisted_3$6,[f[0]||(f[0]=createBaseVNode("div",null,[createBaseVNode("span",{"text-xs":"",text:"pink-400/90 dark:pink-600/90","font-semibold":"",class:"inline x.id===_.value);if(!b){u.value=void 0;return}u.value=b}function c(y){const _=y.target;n.stageView=_.value}function v(y){const _=y.target.value;switch(t.value){case"en":case"en-US":m.value=_;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":m.value=_;break;case"jp":case"jp-JP":s.value=_;break}}return watch([d,f],async([y,_])=>{if(!y||!_){a.value=[];return}a.value=await l(y,_)}),onMounted(async()=>{!d.value||!f.value||(a.value=await l(d.value,f.value))}),(y,_)=>(openBlock(),createElementBlock("div",null,[_[9]||(_[9]=createBaseVNode("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," Settings ",-1)),createBaseVNode("div",null,[createBaseVNode("div",_hoisted_1$6,[createBaseVNode("div",_hoisted_2$6,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.openai-base-url.label")),1)]),createBaseVNode("div",_hoisted_3$5,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[0]||(_[0]=b=>unref(n).openAiApiBaseURL=b),type:"text",placeholder:unref(e)("settings.openai-base-url.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,_hoisted_4$3),[[vModelText,unref(n).openAiApiBaseURL]])]),createBaseVNode("div",_hoisted_5$3,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.openai-api-key.label")),1)]),createBaseVNode("div",_hoisted_6$2,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[1]||(_[1]=b=>unref(n).openAiApiKey=b),type:"text",placeholder:unref(e)("settings.openai-api-key.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,_hoisted_7$1),[[vModelText,unref(n).openAiApiKey]])]),createBaseVNode("div",_hoisted_8$1,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.elevenlabs-api-key.label")),1)]),createBaseVNode("div",_hoisted_9$1,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[2]||(_[2]=b=>unref(n).elevenLabsApiKey=b),type:"text",placeholder:unref(e)("settings.elevenlabs-api-key.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,_hoisted_10$1),[[vModelText,unref(n).elevenLabsApiKey]])]),createBaseVNode("div",_hoisted_11$1,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.language")),1)]),createBaseVNode("div",_hoisted_12$1,[withDirectives(createBaseVNode("select",{"onUpdate:modelValue":_[3]||(_[3]=b=>unref(n).language=b),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},_[5]||(_[5]=[createBaseVNode("option",{value:"en-US"}," English ",-1),createBaseVNode("option",{value:"zh-CN"}," 简体中文 ",-1)]),512),[[vModelSelect,unref(n).language]])]),createBaseVNode("div",_hoisted_13$1,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.models")),1)]),createBaseVNode("div",_hoisted_14$1,[createBaseVNode("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:o},[createBaseVNode("option",_hoisted_15$1,toDisplayString(unref(e)("stage.select-a-model")),1),unref(n).openAiModel?(openBlock(),createElementBlock("option",{key:0,value:unref(n).openAiModel.id},toDisplayString("name"in unref(n).openAiModel?`${unref(n).openAiModel.name} (${unref(n).openAiModel.id})`:unref(n).openAiModel.id),9,_hoisted_16$1)):createCommentVNode("",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(a.value,b=>(openBlock(),createElementBlock("option",{key:b.id,value:b.id},toDisplayString("name"in b?`${b.name} (${b.id})`:b.id),9,_hoisted_17$1))),128))],32)]),createBaseVNode("div",_hoisted_18$1,[createBaseVNode("span",null,toDisplayString(unref(e)("settings.voices")),1)]),createBaseVNode("div",_hoisted_19$1,[createBaseVNode("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:v},[createBaseVNode("option",_hoisted_20$1,toDisplayString(unref(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(unref(t))!==-1&&unref(m)?(openBlock(),createElementBlock("option",{key:0,value:unref(m)},toDisplayString(unref(m)),9,_hoisted_21$1)):createCommentVNode("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(unref(t))!==-1&&unref(m)?(openBlock(),createElementBlock("option",{key:1,value:unref(m)},toDisplayString(unref(m)),9,_hoisted_22)):createCommentVNode("",!0),["jp","jp-JP"].indexOf(unref(t))!==-1&&unref(s)?(openBlock(),createElementBlock("option",{key:2,value:unref(s)},toDisplayString(unref(s)),9,_hoisted_23)):createCommentVNode("",!0),(openBlock(!0),createElementBlock(Fragment,null,renderList(unref(voiceList)[unref(t)],(b,x)=>(openBlock(),createElementBlock("option",{key:x,value:b},toDisplayString(b),9,_hoisted_24))),128))],32)])])]),_[10]||(_[10]=createBaseVNode("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," View ",-1)),createBaseVNode("div",null,[createBaseVNode("div",_hoisted_25,[_[7]||(_[7]=createBaseVNode("div",{text:"sm pink-500"},[createBaseVNode("span",null,"Viewer")],-1)),createBaseVNode("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:c},_[6]||(_[6]=[createBaseVNode("option",{value:"2d"}," 2D ",-1),createBaseVNode("option",{value:"3d"}," 3D ",-1)]),32),_[8]||(_[8]=createBaseVNode("div",{text:"sm pink-500"},[createBaseVNode("span",null,"Theme")],-1)),createBaseVNode("label",_hoisted_26,[withDirectives(createBaseVNode("input",{"onUpdate:modelValue":_[4]||(_[4]=b=>isRef(i)?i.value=b:null),checked:unref(i),"aria-checked":unref(i),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_27),[[vModelCheckbox,unref(i)]]),createBaseVNode("div",_hoisted_28,[createVNode(Transition,{name:"slide-away",mode:"out-in"},{default:withCtx(()=>[unref(i)?(openBlock(),createElementBlock("div",_hoisted_29)):(openBlock(),createElementBlock("div",_hoisted_30))]),_:1})])])])])]))}}),_hoisted_1$5={relative:"","w-full":"",flex:"","gap-1":""},_hoisted_2$5={flex:"","flex-1":""},_hoisted_3$4={class:"flex flex-1 flex-col rounded-t-lg p-5",bg:"[#fffbff] dark:[#1f1a1d]","gap-2":""},_sfc_main$9=defineComponent({__name:"MobileInteractiveArea",setup(r){const e=ref$1(""),t=ref$1(!1),{isAudioInputOn:n,selectedAudioDeviceId:i}=storeToRefs(useSettings()),{send:a,onAfterSend:l}=useChatStore(),{t:u}=useI18n();async function d(){e.value.trim()&&await a(e.value)}const{destroy:f,start:m}=useMicVAD(i,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:o=>{t.value=!1,s()},auto:!1});function s(o){alert("Transcription is not implemented yet")}return watch(n,async o=>{o==="false"&&f()}),l(async()=>{e.value=""}),onMounted(()=>{m()}),(o,c)=>(openBlock(),createElementBlock("div",null,[createBaseVNode("div",_hoisted_1$5,[createVNode(_sfc_main$b,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),createBaseVNode("div",_hoisted_2$5,[createVNode(_sfc_main$k,{modelValue:e.value,"onUpdate:modelValue":c[0]||(c[0]=v=>e.value=v),placeholder:unref(u)("stage.message"),border:"solid 2 pink-100 dark:pink-400/20",text:"pink-400 hover:pink-600 dark:[#905073] dark:hover:pink-600 placeholder:pink-400 placeholder:hover:pink-600 placeholder:dark:[#905073] placeholder:dark:hover:pink-600",bg:"pink-50 dark:[#3c2632]","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-l-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",onSubmit:d},null,8,["modelValue","placeholder"])]),createVNode(unref(vt),{"should-scale-background":""},{default:withCtx(()=>[createVNode(unref(eu),{class:"px-4 py-2.5",border:"solid 2 pink-100 dark:pink-400/20",text:"lg pink-400 hover:pink-600 dark:[#905073] dark:hover:pink-600 placeholder:pink-400 placeholder:hover:pink-600 placeholder:dark:[#905073] placeholder:dark:hover:pink-600",bg:"pink-50 dark:[#3c2632]","max-h":"[10lh]","min-h":"[1lh]","rounded-r-xl":""},{default:withCtx(()=>c[1]||(c[1]=[createBaseVNode("div",{"i-solar:settings-bold-duotone":""},null,-1)])),_:1}),createVNode(unref(Pv),null,{default:withCtx(()=>[createVNode(unref(mt),{class:"fixed inset-0 z-50 bg-black/40"}),createVNode(unref(gt),{"max-h":"[75%]",fixed:"","bottom-0":"","left-0":"","right-0":"","z-50":"","mt-24":"","h-full":"",flex:"","flex-col":"","rounded-t-lg":"",bg:"[#fffbff] dark:[#1f1a1d]"},{default:withCtx(()=>[createBaseVNode("div",_hoisted_3$4,[createVNode(_sfc_main$a)])]),_:1})]),_:1})]),_:1})])]))}}),generateSpeech=async r=>await(r.fetch??globalThis.fetch)(requestURL("audio/speech",r.baseURL),{body:requestBody(r),headers:requestHeaders({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(e=>e.arrayBuffer()),generateCRO=(r,{apiKey:e,baseURL:t,headers:n})=>({apiKey:e,baseURL:t,headers:n,model:r}),createOllama=r=>{const e={...r,baseURL:new URL("http://localhost:11434/v1/")},t=n=>generateCRO(n,e);return{chat:t,embed:t,model:()=>e}};createOllama();const createUnElevenLabs=r=>{const e=({applyTextNormalization:t,languageCode:n,model:i,nextRequestIds:a,nextText:l,previousRequestIds:u,previousText:d,pronunciationDictionaryLocators:f,seed:m,voice:s,voiceSettings:o})=>({extraBody:objCamelToSnake({applyTextNormalization:t,languageCode:n,nextRequestIds:a,nextText:l,previousRequestIds:u,previousText:d,pronunciationDictionaryLocators:f?f.map(c=>objCamelToSnake(c)):void 0,seed:m,voiceSettings:o?objCamelToSnake(o):void 0}),model:`elevenlabs/${i}`,voice:s});return{speech:t=>({...e(t),...generateCRO(t.model,{...r,baseURL:(r==null?void 0:r.baseURL)??new URL("http://localhost:5933/v1/")})})}};/*! - * @pixi/constants - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/constants is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */var ENV;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(ENV||(ENV={}));var RENDERER_TYPE;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(RENDERER_TYPE||(RENDERER_TYPE={}));var BUFFER_BITS;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(BUFFER_BITS||(BUFFER_BITS={}));var BLEND_MODES;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(BLEND_MODES||(BLEND_MODES={}));var DRAW_MODES;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(DRAW_MODES||(DRAW_MODES={}));var FORMATS;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(FORMATS||(FORMATS={}));var TARGETS;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(TARGETS||(TARGETS={}));var TYPES;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})(TYPES||(TYPES={}));var SAMPLER_TYPES;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(SAMPLER_TYPES||(SAMPLER_TYPES={}));var SCALE_MODES;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(SCALE_MODES||(SCALE_MODES={}));var WRAP_MODES;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(WRAP_MODES||(WRAP_MODES={}));var MIPMAP_MODES;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(MIPMAP_MODES||(MIPMAP_MODES={}));var ALPHA_MODES$1;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(ALPHA_MODES$1||(ALPHA_MODES$1={}));var CLEAR_MODES;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(CLEAR_MODES||(CLEAR_MODES={}));var GC_MODES;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(GC_MODES||(GC_MODES={}));var PRECISION;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(PRECISION||(PRECISION={}));var MASK_TYPES;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(MASK_TYPES||(MASK_TYPES={}));var COLOR_MASK_BITS;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(COLOR_MASK_BITS||(COLOR_MASK_BITS={}));var MSAA_QUALITY;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(MSAA_QUALITY||(MSAA_QUALITY={}));var BUFFER_TYPE;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(BUFFER_TYPE||(BUFFER_TYPE={}));/*! - * @pixi/settings - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/settings is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */var BrowserAdapter={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},appleIphone=/iPhone/i,appleIpod=/iPod/i,appleTablet=/iPad/i,appleUniversal=/\biOS-universal(?:.+)Mac\b/i,androidPhone=/\bAndroid(?:.+)Mobile\b/i,androidTablet=/Android/i,amazonPhone=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,amazonTablet=/Silk/i,windowsPhone=/Windows Phone/i,windowsTablet=/\bWindows(?:.+)ARM\b/i,otherBlackBerry=/BlackBerry/i,otherBlackBerry10=/BB10/i,otherOpera=/Opera Mini/i,otherChrome=/\b(CriOS|Chrome)(?:.+)Mobile/i,otherFirefox=/Mobile(?:.+)Firefox\b/i,isAppleTabletOnIos13=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function createMatch(r){return function(e){return e.test(r)}}function isMobile$1(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,n=t.split("[FBAN");typeof n[1]<"u"&&(t=n[0]),n=t.split("Twitter"),typeof n[1]<"u"&&(t=n[0]);var i=createMatch(t),a={apple:{phone:i(appleIphone)&&!i(windowsPhone),ipod:i(appleIpod),tablet:!i(appleIphone)&&(i(appleTablet)||isAppleTabletOnIos13(e))&&!i(windowsPhone),universal:i(appleUniversal),device:(i(appleIphone)||i(appleIpod)||i(appleTablet)||i(appleUniversal)||isAppleTabletOnIos13(e))&&!i(windowsPhone)},amazon:{phone:i(amazonPhone),tablet:!i(amazonPhone)&&i(amazonTablet),device:i(amazonPhone)||i(amazonTablet)},android:{phone:!i(windowsPhone)&&i(amazonPhone)||!i(windowsPhone)&&i(androidPhone),tablet:!i(windowsPhone)&&!i(amazonPhone)&&!i(androidPhone)&&(i(amazonTablet)||i(androidTablet)),device:!i(windowsPhone)&&(i(amazonPhone)||i(amazonTablet)||i(androidPhone)||i(androidTablet))||i(/\bokhttp\b/i)},windows:{phone:i(windowsPhone),tablet:i(windowsTablet),device:i(windowsPhone)||i(windowsTablet)},other:{blackberry:i(otherBlackBerry),blackberry10:i(otherBlackBerry10),opera:i(otherOpera),firefox:i(otherFirefox),chrome:i(otherChrome),device:i(otherBlackBerry)||i(otherBlackBerry10)||i(otherOpera)||i(otherFirefox)||i(otherChrome)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var isMobile=isMobile$1(globalThis.navigator);function canUploadSameBuffer(){return!isMobile.apple.device}function maxRecommendedTextures(r){var e=!0;if(isMobile.tablet||isMobile.phone){if(isMobile.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var n=parseInt(t[1],10);n<11&&(e=!1)}}if(isMobile.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var n=parseInt(t[1],10);n<7&&(e=!1)}}}return e?r:4}var settings={ADAPTER:BrowserAdapter,MIPMAP_TEXTURES:MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:maxRecommendedTextures(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:GC_MODES.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:WRAP_MODES.CLAMP,SCALE_MODE:SCALE_MODES.LINEAR,PRECISION_VERTEX:PRECISION.HIGH,PRECISION_FRAGMENT:isMobile.apple.device?PRECISION.HIGH:PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:canUploadSameBuffer(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},eventemitter3={exports:{}},hasRequiredEventemitter3;function requireEventemitter3(){return hasRequiredEventemitter3||(hasRequiredEventemitter3=1,function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(d,f,m){this.fn=d,this.context=f,this.once=m||!1}function a(d,f,m,s,o){if(typeof m!="function")throw new TypeError("The listener must be a function");var c=new i(m,s||d,o),v=t?t+f:f;return d._events[v]?d._events[v].fn?d._events[v]=[d._events[v],c]:d._events[v].push(c):(d._events[v]=c,d._eventsCount++),d}function l(d,f){--d._eventsCount===0?d._events=new n:delete d._events[f]}function u(){this._events=new n,this._eventsCount=0}u.prototype.eventNames=function(){var f=[],m,s;if(this._eventsCount===0)return f;for(s in m=this._events)e.call(m,s)&&f.push(t?s.slice(1):s);return Object.getOwnPropertySymbols?f.concat(Object.getOwnPropertySymbols(m)):f},u.prototype.listeners=function(f){var m=t?t+f:f,s=this._events[m];if(!s)return[];if(s.fn)return[s.fn];for(var o=0,c=s.length,v=new Array(c);o80*H){z=fe=L[0],_e=We=L[1];for(var K=H;Kfe&&(fe=ft),Te>We&&(We=Te);G=Math.max(fe-z,We-_e),G=G!==0?32767/G:0}return n(X,Z,H,z,_e,G,0),Z}function e(L,U,H,Y,B){var X,Z;if(B===W(L,U,H,Y)>0)for(X=U;X=U;X-=Y)Z=k(X,L[X],L[X+1],Z);return Z&&S(Z,Z.next)&&(j(Z),Z=Z.next),Z}function t(L,U){if(!L)return L;U||(U=L);var H=L,Y;do if(Y=!1,!H.steiner&&(S(H,H.next)||w(H.prev,H,H.next)===0)){if(j(H),H=U=H.prev,H===H.next)break;Y=!0}else H=H.next;while(Y||H!==U);return U}function n(L,U,H,Y,B,X,Z){if(L){!Z&&X&&c(L,Y,B,X);for(var z=L,_e,fe;L.prev!==L.next;){if(_e=L.prev,fe=L.next,X?a(L,Y,B,X):i(L)){U.push(_e.i/H|0),U.push(L.i/H|0),U.push(fe.i/H|0),j(L),L=fe.next,z=fe.next;continue}if(L=fe,L===z){Z?Z===1?(L=l(t(L),U,H),n(L,U,H,Y,B,X,2)):Z===2&&u(L,U,H,Y,B,X):n(t(L),U,H,Y,B,X,1);break}}}}function i(L){var U=L.prev,H=L,Y=L.next;if(w(U,H,Y)>=0)return!1;for(var B=U.x,X=H.x,Z=Y.x,z=U.y,_e=H.y,fe=Y.y,We=BX?B>Z?B:Z:X>Z?X:Z,G=z>_e?z>fe?z:fe:_e>fe?_e:fe,K=Y.next;K!==U;){if(K.x>=We&&K.x<=Te&&K.y>=ft&&K.y<=G&&b(B,z,X,_e,Z,fe,K.x,K.y)&&w(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function a(L,U,H,Y){var B=L.prev,X=L,Z=L.next;if(w(B,X,Z)>=0)return!1;for(var z=B.x,_e=X.x,fe=Z.x,We=B.y,ft=X.y,Te=Z.y,G=z<_e?z_e?z>fe?z:fe:_e>fe?_e:fe,ke=We>ft?We>Te?We:Te:ft>Te?ft:Te,Ie=y(G,K,U,H,Y),F=y(ue,ke,U,H,Y),ge=L.prevZ,le=L.nextZ;ge&&ge.z>=Ie&&le&&le.z<=F;){if(ge.x>=G&&ge.x<=ue&&ge.y>=K&&ge.y<=ke&&ge!==B&&ge!==Z&&b(z,We,_e,ft,fe,Te,ge.x,ge.y)&&w(ge.prev,ge,ge.next)>=0||(ge=ge.prevZ,le.x>=G&&le.x<=ue&&le.y>=K&&le.y<=ke&&le!==B&&le!==Z&&b(z,We,_e,ft,fe,Te,le.x,le.y)&&w(le.prev,le,le.next)>=0))return!1;le=le.nextZ}for(;ge&&ge.z>=Ie;){if(ge.x>=G&&ge.x<=ue&&ge.y>=K&&ge.y<=ke&&ge!==B&&ge!==Z&&b(z,We,_e,ft,fe,Te,ge.x,ge.y)&&w(ge.prev,ge,ge.next)>=0)return!1;ge=ge.prevZ}for(;le&&le.z<=F;){if(le.x>=G&&le.x<=ue&&le.y>=K&&le.y<=ke&&le!==B&&le!==Z&&b(z,We,_e,ft,fe,Te,le.x,le.y)&&w(le.prev,le,le.next)>=0)return!1;le=le.nextZ}return!0}function l(L,U,H){var Y=L;do{var B=Y.prev,X=Y.next.next;!S(B,X)&&T(B,Y,Y.next,X)&&A(B,X)&&A(X,B)&&(U.push(B.i/H|0),U.push(Y.i/H|0),U.push(X.i/H|0),j(Y),j(Y.next),Y=L=X),Y=Y.next}while(Y!==L);return t(Y)}function u(L,U,H,Y,B,X){var Z=L;do{for(var z=Z.next.next;z!==Z.prev;){if(Z.i!==z.i&&x(Z,z)){var _e=D(Z,z);Z=t(Z,Z.next),_e=t(_e,_e.next),n(Z,U,H,Y,B,X,0),n(_e,U,H,Y,B,X,0);return}z=z.next}Z=Z.next}while(Z!==L)}function d(L,U,H,Y){var B=[],X,Z,z,_e,fe;for(X=0,Z=U.length;X=H.next.y&&H.next.y!==H.y){var z=H.x+(B-H.y)*(H.next.x-H.x)/(H.next.y-H.y);if(z<=Y&&z>X&&(X=z,Z=H.x=H.x&&H.x>=fe&&Y!==H.x&&b(BZ.x||H.x===Z.x&&o(Z,H)))&&(Z=H,ft=Te)),H=H.next;while(H!==_e);return Z}function o(L,U){return w(L.prev,L,U.prev)<0&&w(U.next,L,L.next)<0}function c(L,U,H,Y){var B=L;do B.z===0&&(B.z=y(B.x,B.y,U,H,Y)),B.prevZ=B.prev,B.nextZ=B.next,B=B.next;while(B!==L);B.prevZ.nextZ=null,B.prevZ=null,v(B)}function v(L){var U,H,Y,B,X,Z,z,_e,fe=1;do{for(H=L,L=null,X=null,Z=0;H;){for(Z++,Y=H,z=0,U=0;U0||_e>0&&Y;)z!==0&&(_e===0||!Y||H.z<=Y.z)?(B=H,H=H.nextZ,z--):(B=Y,Y=Y.nextZ,_e--),X?X.nextZ=B:L=B,B.prevZ=X,X=B;H=Y}X.nextZ=null,fe*=2}while(Z>1);return L}function y(L,U,H,Y,B){return L=(L-H)*B|0,U=(U-Y)*B|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,U=(U|U<<8)&16711935,U=(U|U<<4)&252645135,U=(U|U<<2)&858993459,U=(U|U<<1)&1431655765,L|U<<1}function _(L){var U=L,H=L;do(U.x=(L-Z)*(X-z)&&(L-Z)*(Y-z)>=(H-Z)*(U-z)&&(H-Z)*(X-z)>=(B-Z)*(Y-z)}function x(L,U){return L.next.i!==U.i&&L.prev.i!==U.i&&!P(L,U)&&(A(L,U)&&A(U,L)&&C(L,U)&&(w(L.prev,L,U.prev)||w(L,U.prev,U))||S(L,U)&&w(L.prev,L,L.next)>0&&w(U.prev,U,U.next)>0)}function w(L,U,H){return(U.y-L.y)*(H.x-U.x)-(U.x-L.x)*(H.y-U.y)}function S(L,U){return L.x===U.x&&L.y===U.y}function T(L,U,H,Y){var B=M(w(L,U,H)),X=M(w(L,U,Y)),Z=M(w(H,Y,L)),z=M(w(H,Y,U));return!!(B!==X&&Z!==z||B===0&&E(L,H,U)||X===0&&E(L,Y,U)||Z===0&&E(H,L,Y)||z===0&&E(H,U,Y))}function E(L,U,H){return U.x<=Math.max(L.x,H.x)&&U.x>=Math.min(L.x,H.x)&&U.y<=Math.max(L.y,H.y)&&U.y>=Math.min(L.y,H.y)}function M(L){return L>0?1:L<0?-1:0}function P(L,U){var H=L;do{if(H.i!==L.i&&H.next.i!==L.i&&H.i!==U.i&&H.next.i!==U.i&&T(H,H.next,L,U))return!0;H=H.next}while(H!==L);return!1}function A(L,U){return w(L.prev,L,L.next)<0?w(L,U,L.next)>=0&&w(L,L.prev,U)>=0:w(L,U,L.prev)<0||w(L,L.next,U)<0}function C(L,U){var H=L,Y=!1,B=(L.x+U.x)/2,X=(L.y+U.y)/2;do H.y>X!=H.next.y>X&&H.next.y!==H.y&&B<(H.next.x-H.x)*(X-H.y)/(H.next.y-H.y)+H.x&&(Y=!Y),H=H.next;while(H!==L);return Y}function D(L,U){var H=new I(L.i,L.x,L.y),Y=new I(U.i,U.x,U.y),B=L.next,X=U.prev;return L.next=U,U.prev=L,H.next=B,B.prev=H,Y.next=H,H.prev=Y,X.next=Y,Y.prev=X,Y}function k(L,U,H,Y){var B=new I(L,U,H);return Y?(B.next=Y.next,B.prev=Y,Y.next.prev=B,Y.next=B):(B.prev=B,B.next=B),B}function j(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function I(L,U,H){this.i=L,this.x=U,this.y=H,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(L,U,H,Y){var B=U&&U.length,X=B?U[0]*H:L.length,Z=Math.abs(W(L,0,X,H));if(B)for(var z=0,_e=U.length;z<_e;z++){var fe=U[z]*H,We=z<_e-1?U[z+1]*H:L.length;Z-=Math.abs(W(L,fe,We,H))}var ft=0;for(z=0;z0&&(Y+=L[B-1].length,H.holes.push(Y))}return H},earcut.exports}requireEarcut();var url$1={},punycode$1={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var punycode=punycode$1.exports,hasRequiredPunycode;function requirePunycode(){return hasRequiredPunycode||(hasRequiredPunycode=1,function(r,e){(function(t){var n=e&&!e.nodeType&&e,i=!r.nodeType&&r,a=typeof commonjsGlobal=="object"&&commonjsGlobal;(a.global===a||a.window===a||a.self===a)&&(t=a);var l,u=2147483647,d=36,f=1,m=26,s=38,o=700,c=72,v=128,y="-",_=/^xn--/,b=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=d-f,T=Math.floor,E=String.fromCharCode,M;function P(B){throw new RangeError(w[B])}function A(B,X){for(var Z=B.length,z=[];Z--;)z[Z]=X(B[Z]);return z}function C(B,X){var Z=B.split("@"),z="";Z.length>1&&(z=Z[0]+"@",B=Z[1]),B=B.replace(x,".");var _e=B.split("."),fe=A(_e,X).join(".");return z+fe}function D(B){for(var X=[],Z=0,z=B.length,_e,fe;Z=55296&&_e<=56319&&Z65535&&(X-=65536,Z+=E(X>>>10&1023|55296),X=56320|X&1023),Z+=E(X),Z}).join("")}function j(B){return B-48<10?B-22:B-65<26?B-65:B-97<26?B-97:d}function I(B,X){return B+22+75*(B<26)-((X!=0)<<5)}function W(B,X,Z){var z=0;for(B=Z?T(B/o):B>>1,B+=T(B/X);B>S*m>>1;z+=d)B=T(B/S);return T(z+(S+1)*B/(B+s))}function L(B){var X=[],Z=B.length,z,_e=0,fe=v,We=c,ft,Te,G,K,ue,ke,Ie,F,ge;for(ft=B.lastIndexOf(y),ft<0&&(ft=0),Te=0;Te=128&&P("not-basic"),X.push(B.charCodeAt(Te));for(G=ft>0?ft+1:0;G=Z&&P("invalid-input"),Ie=j(B.charCodeAt(G++)),(Ie>=d||Ie>T((u-_e)/ue))&&P("overflow"),_e+=Ie*ue,F=ke<=We?f:ke>=We+m?m:ke-We,!(IeT(u/ge)&&P("overflow"),ue*=ge;z=X.length+1,We=W(_e-K,z,K==0),T(_e/z)>u-fe&&P("overflow"),fe+=T(_e/z),_e%=z,X.splice(_e++,0,fe)}return k(X)}function U(B){var X,Z,z,_e,fe,We,ft,Te,G,K,ue,ke=[],Ie,F,ge,le;for(B=D(B),Ie=B.length,X=v,Z=0,fe=c,We=0;We=X&&ueT((u-Z)/F)&&P("overflow"),Z+=(ft-X)*F,X=ft,We=0;Weu&&P("overflow"),ue==X){for(Te=Z,G=d;K=G<=fe?f:G>=fe+m?m:G-fe,!(Te"u"||!y?r:y(Uint8Array),x={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":c&&y?y([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":_,"%AsyncGenerator%":_,"%AsyncGeneratorFunction%":_,"%AsyncIteratorPrototype%":_,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":d,"%GeneratorFunction%":_,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":c&&y?y(y([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!c||!y?r:y(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!c||!y?r:y(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":c&&y?y(""[Symbol.iterator]()):r,"%Symbol%":c?Symbol:r,"%SyntaxError%":a,"%ThrowTypeError%":o,"%TypedArray%":b,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(y)try{null.error}catch(U){var w=y(y(U));x["%Error.prototype%"]=w}var S=function U(H){var Y;if(H==="%AsyncFunction%")Y=f("async function () {}");else if(H==="%GeneratorFunction%")Y=f("function* () {}");else if(H==="%AsyncGeneratorFunction%")Y=f("async function* () {}");else if(H==="%AsyncGenerator%"){var B=U("%AsyncGeneratorFunction%");B&&(Y=B.prototype)}else if(H==="%AsyncIteratorPrototype%"){var X=U("%AsyncGenerator%");X&&y&&(Y=y(X.prototype))}return x[H]=Y,Y},T={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},E=requireFunctionBind(),M=requireHasown(),P=E.call(Function.call,Array.prototype.concat),A=E.call(Function.apply,Array.prototype.splice),C=E.call(Function.call,String.prototype.replace),D=E.call(Function.call,String.prototype.slice),k=E.call(Function.call,RegExp.prototype.exec),j=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,I=/\\(\\)?/g,W=function(H){var Y=D(H,0,1),B=D(H,-1);if(Y==="%"&&B!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(B==="%"&&Y!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var X=[];return C(H,j,function(Z,z,_e,fe){X[X.length]=_e?C(fe,I,"$1"):z||Z}),X},L=function(H,Y){var B=H,X;if(M(T,B)&&(X=T[B],B="%"+X[0]+"%"),M(x,B)){var Z=x[B];if(Z===_&&(Z=S(B)),typeof Z>"u"&&!Y)throw new l("intrinsic "+H+" exists, but is not available. Please file an issue!");return{alias:X,name:B,value:Z}}throw new a("intrinsic "+H+" does not exist!")};return getIntrinsic=function(H,Y){if(typeof H!="string"||H.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Y!="boolean")throw new l('"allowMissing" argument must be a boolean');if(k(/^%?[^%]*%?$/,H)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var B=W(H),X=B.length>0?B[0]:"",Z=L("%"+X+"%",Y),z=Z.name,_e=Z.value,fe=!1,We=Z.alias;We&&(X=We[0],A(B,P([0,1],We)));for(var ft=1,Te=!0;ft=B.length){var ke=m(_e,G);Te=!!ke,Te&&"get"in ke&&!("originalValue"in ke.get)?_e=ke.get:_e=_e[G]}else Te=M(_e,G),_e=_e[G];Te&&!fe&&(x[z]=_e)}}return _e},getIntrinsic}var callBind={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var r=requireGetIntrinsic(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return esDefineProperty=e,esDefineProperty}var gopd,hasRequiredGopd;function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var r=requireGetIntrinsic(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return gopd=e,gopd}var defineDataProperty,hasRequiredDefineDataProperty;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var r=requireEsDefineProperty(),e=requireSyntax(),t=requireType(),n=requireGopd();return defineDataProperty=function(a,l,u){if(!a||typeof a!="object"&&typeof a!="function")throw new t("`obj` must be an object or a function`");if(typeof l!="string"&&typeof l!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var d=arguments.length>3?arguments[3]:null,f=arguments.length>4?arguments[4]:null,m=arguments.length>5?arguments[5]:null,s=arguments.length>6?arguments[6]:!1,o=!!n&&n(a,l);if(r)r(a,l,{configurable:m===null&&o?o.configurable:!m,enumerable:d===null&&o?o.enumerable:!d,value:u,writable:f===null&&o?o.writable:!f});else if(s||!d&&!f&&!m)a[l]=u;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},defineDataProperty}var hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors;function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var r=requireEsDefineProperty(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},hasPropertyDescriptors_1=e,hasPropertyDescriptors_1}var setFunctionLength,hasRequiredSetFunctionLength;function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var r=requireGetIntrinsic(),e=requireDefineDataProperty(),t=requireHasPropertyDescriptors()(),n=requireGopd(),i=requireType(),a=r("%Math.floor%");return setFunctionLength=function(u,d){if(typeof u!="function")throw new i("`fn` is not a function");if(typeof d!="number"||d<0||d>4294967295||a(d)!==d)throw new i("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],m=!0,s=!0;if("length"in u&&n){var o=n(u,"length");o&&!o.configurable&&(m=!1),o&&!o.writable&&(s=!1)}return(m||s||!f)&&(t?e(u,"length",d,!0,!0):e(u,"length",d)),u},setFunctionLength}var hasRequiredCallBind;function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,function(r){var e=requireFunctionBind(),t=requireGetIntrinsic(),n=requireSetFunctionLength(),i=requireType(),a=t("%Function.prototype.apply%"),l=t("%Function.prototype.call%"),u=t("%Reflect.apply%",!0)||e.call(l,a),d=requireEsDefineProperty(),f=t("%Math.max%");r.exports=function(o){if(typeof o!="function")throw new i("a function is required");var c=u(e,l,arguments);return n(c,1+f(0,o.length-(arguments.length-1)),!0)};var m=function(){return u(e,a,arguments)};d?d(r.exports,"apply",{value:m}):r.exports.apply=m}(callBind)),callBind.exports}var callBound,hasRequiredCallBound;function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var r=requireGetIntrinsic(),e=requireCallBind(),t=e(r("String.prototype.indexOf"));return callBound=function(i,a){var l=r(i,!!a);return typeof l=="function"&&t(i,".prototype.")>-1?e(l):l},callBound}const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(__viteBrowserExternal$1);var objectInspect,hasRequiredObjectInspect;function requireObjectInspect(){if(hasRequiredObjectInspect)return objectInspect;hasRequiredObjectInspect=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,a=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,l=i&&a&&typeof a.get=="function"?a.get:null,u=i&&Set.prototype.forEach,d=typeof WeakMap=="function"&&WeakMap.prototype,f=d?WeakMap.prototype.has:null,m=typeof WeakSet=="function"&&WeakSet.prototype,s=m?WeakSet.prototype.has:null,o=typeof WeakRef=="function"&&WeakRef.prototype,c=o?WeakRef.prototype.deref:null,v=Boolean.prototype.valueOf,y=Object.prototype.toString,_=Function.prototype.toString,b=String.prototype.match,x=String.prototype.slice,w=String.prototype.replace,S=String.prototype.toUpperCase,T=String.prototype.toLowerCase,E=RegExp.prototype.test,M=Array.prototype.concat,P=Array.prototype.join,A=Array.prototype.slice,C=Math.floor,D=typeof BigInt=="function"?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,I=typeof Symbol=="function"&&typeof Symbol.iterator=="object",W=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===I||!0)?Symbol.toStringTag:null,L=Object.prototype.propertyIsEnumerable,U=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(ee){return ee.__proto__}:null);function H(ee,ce){if(ee===1/0||ee===-1/0||ee!==ee||ee&&ee>-1e3&&ee<1e3||E.call(/e/,ce))return ce;var wt=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof ee=="number"){var Ct=ee<0?-C(-ee):C(ee);if(Ct!==ee){var It=String(Ct),Dt=x.call(ce,It.length+1);return w.call(It,wt,"$&_")+"."+w.call(w.call(Dt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return w.call(ce,wt,"$&_")}var Y=require$$0,B=Y.custom,X=Ie(B)?B:null,Z={__proto__:null,double:'"',single:"'"},z={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};objectInspect=function ee(ce,wt,Ct,It){var Dt=wt||{};if(le(Dt,"quoteStyle")&&!le(Z,Dt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(le(Dt,"maxStringLength")&&(typeof Dt.maxStringLength=="number"?Dt.maxStringLength<0&&Dt.maxStringLength!==1/0:Dt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var rn=le(Dt,"customInspect")?Dt.customInspect:!0;if(typeof rn!="boolean"&&rn!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(le(Dt,"indent")&&Dt.indent!==null&&Dt.indent!==" "&&!(parseInt(Dt.indent,10)===Dt.indent&&Dt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(le(Dt,"numericSeparator")&&typeof Dt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var tn=Dt.numericSeparator;if(typeof ce>"u")return"undefined";if(ce===null)return"null";if(typeof ce=="boolean")return ce?"true":"false";if(typeof ce=="string")return Ce(ce,Dt);if(typeof ce=="number"){if(ce===0)return 1/0/ce>0?"0":"-0";var Ot=String(ce);return tn?H(ce,Ot):Ot}if(typeof ce=="bigint"){var kt=String(ce)+"n";return tn?H(ce,kt):kt}var Bt=typeof Dt.depth>"u"?5:Dt.depth;if(typeof Ct>"u"&&(Ct=0),Ct>=Bt&&Bt>0&&typeof ce=="object")return We(ce)?"[Array]":"[Object]";var ln=Vt(Dt,Ct);if(typeof It>"u")It=[];else if(pe(It,ce)>=0)return"[Circular]";function en(Ge,qe,At){if(qe&&(It=A.call(It),It.push(qe)),At){var Ft={depth:Dt.depth};return le(Dt,"quoteStyle")&&(Ft.quoteStyle=Dt.quoteStyle),ee(Ge,Ft,Ct+1,It)}return ee(Ge,Dt,Ct+1,It)}if(typeof ce=="function"&&!Te(ce)){var dn=oe(ce),In=Rt(ce,en);return"[Function"+(dn?": "+dn:" (anonymous)")+"]"+(In.length>0?" { "+P.call(In,", ")+" }":"")}if(Ie(ce)){var Rn=I?w.call(String(ce),/^(Symbol\(.*\))_[^)]*$/,"$1"):j.call(ce);return typeof ce=="object"&&!I?xt(Rn):Rn}if(Xe(ce)){for(var hn="<"+T.call(String(ce.nodeName)),Sn=ce.attributes||[],mn=0;mn",hn}if(We(ce)){if(ce.length===0)return"[]";var Mn=Rt(ce,en);return ln&&!Yt(Mn)?"["+$t(Mn,ln)+"]":"[ "+P.call(Mn,", ")+" ]"}if(G(ce)){var On=Rt(ce,en);return!("cause"in Error.prototype)&&"cause"in ce&&!L.call(ce,"cause")?"{ ["+String(ce)+"] "+P.call(M.call("[cause]: "+en(ce.cause),On),", ")+" }":On.length===0?"["+String(ce)+"]":"{ ["+String(ce)+"] "+P.call(On,", ")+" }"}if(typeof ce=="object"&&rn){if(X&&typeof ce[X]=="function"&&Y)return Y(ce,{depth:Bt-Ct});if(rn!=="symbol"&&typeof ce.inspect=="function")return ce.inspect()}if(Be(ce)){var kn=[];return n&&n.call(ce,function(Ge,qe){kn.push(en(qe,ce,!0)+" => "+en(Ge,ce))}),Nt("Map",t.call(ce),kn,ln)}if(pt(ce)){var vn=[];return u&&u.call(ce,function(Ge){vn.push(en(Ge,ce))}),Nt("Set",l.call(ce),vn,ln)}if(ze(ce))return Pt("WeakMap");if(Et(ce))return Pt("WeakSet");if(be(ce))return Pt("WeakRef");if(ue(ce))return xt(en(Number(ce)));if(F(ce))return xt(en(D.call(ce)));if(ke(ce))return xt(v.call(ce));if(K(ce))return xt(en(String(ce)));if(typeof window<"u"&&ce===window)return"{ [object Window] }";if(typeof globalThis<"u"&&ce===globalThis||typeof commonjsGlobal<"u"&&ce===commonjsGlobal)return"{ [object globalThis] }";if(!ft(ce)&&!Te(ce)){var yn=Rt(ce,en),Ln=U?U(ce)===Object.prototype:ce instanceof Object||ce.constructor===Object,ie=ce instanceof Object?"":"null prototype",de=!Ln&&W&&Object(ce)===ce&&W in ce?x.call(te(ce),8,-1):ie?"Object":"",Me=Ln||typeof ce.constructor!="function"?"":ce.constructor.name?ce.constructor.name+" ":"",Ne=Me+(de||ie?"["+P.call(M.call([],de||[],ie||[]),": ")+"] ":"");return yn.length===0?Ne+"{}":ln?Ne+"{"+$t(yn,ln)+"}":Ne+"{ "+P.call(yn,", ")+" }"}return String(ce)};function _e(ee,ce,wt){var Ct=wt.quoteStyle||ce,It=Z[Ct];return It+ee+It}function fe(ee){return w.call(String(ee),/"/g,""")}function We(ee){return te(ee)==="[object Array]"&&(!W||!(typeof ee=="object"&&W in ee))}function ft(ee){return te(ee)==="[object Date]"&&(!W||!(typeof ee=="object"&&W in ee))}function Te(ee){return te(ee)==="[object RegExp]"&&(!W||!(typeof ee=="object"&&W in ee))}function G(ee){return te(ee)==="[object Error]"&&(!W||!(typeof ee=="object"&&W in ee))}function K(ee){return te(ee)==="[object String]"&&(!W||!(typeof ee=="object"&&W in ee))}function ue(ee){return te(ee)==="[object Number]"&&(!W||!(typeof ee=="object"&&W in ee))}function ke(ee){return te(ee)==="[object Boolean]"&&(!W||!(typeof ee=="object"&&W in ee))}function Ie(ee){if(I)return ee&&typeof ee=="object"&&ee instanceof Symbol;if(typeof ee=="symbol")return!0;if(!ee||typeof ee!="object"||!j)return!1;try{return j.call(ee),!0}catch{}return!1}function F(ee){if(!ee||typeof ee!="object"||!D)return!1;try{return D.call(ee),!0}catch{}return!1}var ge=Object.prototype.hasOwnProperty||function(ee){return ee in this};function le(ee,ce){return ge.call(ee,ce)}function te(ee){return y.call(ee)}function oe(ee){if(ee.name)return ee.name;var ce=b.call(_.call(ee),/^function\s*([\w$]+)/);return ce?ce[1]:null}function pe(ee,ce){if(ee.indexOf)return ee.indexOf(ce);for(var wt=0,Ct=ee.length;wtce.maxStringLength){var wt=ee.length-ce.maxStringLength,Ct="... "+wt+" more character"+(wt>1?"s":"");return Ce(x.call(ee,0,ce.maxStringLength),ce)+Ct}var It=z[ce.quoteStyle||"single"];It.lastIndex=0;var Dt=w.call(w.call(ee,It,"\\$1"),/[\x00-\x1f]/g,bt);return _e(Dt,"single",ce)}function bt(ee){var ce=ee.charCodeAt(0),wt={8:"b",9:"t",10:"n",12:"f",13:"r"}[ce];return wt?"\\"+wt:"\\x"+(ce<16?"0":"")+S.call(ce.toString(16))}function xt(ee){return"Object("+ee+")"}function Pt(ee){return ee+" { ? }"}function Nt(ee,ce,wt,Ct){var It=Ct?$t(wt,Ct):P.call(wt,", ");return ee+" ("+ce+") {"+It+"}"}function Yt(ee){for(var ce=0;ce=0)return!1;return!0}function Vt(ee,ce){var wt;if(ee.indent===" ")wt=" ";else if(typeof ee.indent=="number"&&ee.indent>0)wt=P.call(Array(ee.indent+1)," ");else return null;return{base:wt,prev:P.call(Array(ce+1),wt)}}function $t(ee,ce){if(ee.length===0)return"";var wt=` -`+ce.prev+ce.base;return wt+P.call(ee,","+wt)+` -`+ce.prev}function Rt(ee,ce){var wt=We(ee),Ct=[];if(wt){Ct.length=ee.length;for(var It=0;It1;){var x=b.pop(),w=x.obj[x.prop];if(t(w)){for(var S=[],T=0;T=f?E.slice(P,P+f):E,C=[],D=0;D=48&&k<=57||k>=65&&k<=90||k>=97&&k<=122||T===r.RFC1738&&(k===40||k===41)){C[C.length]=A.charAt(D);continue}if(k<128){C[C.length]=n[k];continue}if(k<2048){C[C.length]=n[192|k>>6]+n[128|k&63];continue}if(k<55296||k>=57344){C[C.length]=n[224|k>>12]+n[128|k>>6&63]+n[128|k&63];continue}D+=1,k=65536+((k&1023)<<10|A.charCodeAt(D)&1023),C[C.length]=n[240|k>>18]+n[128|k>>12&63]+n[128|k>>6&63]+n[128|k&63]}M+=C.join("")}return M},s=function(b){for(var x=[{obj:{o:b},prop:"o"}],w=[],S=0;S"u"&&(B=0)}if(typeof A=="function"?H=A(b,H):H instanceof Date?H=k(H):x==="comma"&&a(H)&&(H=e.maybeMap(H,function(ge){return ge instanceof Date?k(ge):ge})),H===null){if(T)return P&&!W?P(b,m.encoder,L,"key",j):b;H=""}if(s(H)||e.isBuffer(H)){if(P){var z=W?b:P(b,m.encoder,L,"key",j);return[I(z)+"="+I(P(H,m.encoder,L,"value",j))]}return[I(b)+"="+I(String(H))]}var _e=[];if(typeof H>"u")return _e;var fe;if(x==="comma"&&a(H))W&&P&&(H=e.maybeMap(H,P)),fe=[{value:H.length>0?H.join(",")||null:void 0}];else if(a(A))fe=A;else{var We=Object.keys(H);fe=C?We.sort(C):We}var ft=M?String(b).replace(/\./g,"%2E"):String(b),Te=w&&a(H)&&H.length===1?ft+"[]":ft;if(S&&a(H)&&H.length===0)return Te+"[]";for(var G=0;G"u"?_.encodeDotInKeys===!0?!0:m.allowDots:!!_.allowDots;return{addQueryPrefix:typeof _.addQueryPrefix=="boolean"?_.addQueryPrefix:m.addQueryPrefix,allowDots:E,allowEmptyArrays:typeof _.allowEmptyArrays=="boolean"?!!_.allowEmptyArrays:m.allowEmptyArrays,arrayFormat:T,charset:b,charsetSentinel:typeof _.charsetSentinel=="boolean"?_.charsetSentinel:m.charsetSentinel,commaRoundTrip:!!_.commaRoundTrip,delimiter:typeof _.delimiter>"u"?m.delimiter:_.delimiter,encode:typeof _.encode=="boolean"?_.encode:m.encode,encodeDotInKeys:typeof _.encodeDotInKeys=="boolean"?_.encodeDotInKeys:m.encodeDotInKeys,encoder:typeof _.encoder=="function"?_.encoder:m.encoder,encodeValuesOnly:typeof _.encodeValuesOnly=="boolean"?_.encodeValuesOnly:m.encodeValuesOnly,filter:S,format:x,formatter:w,serializeDate:typeof _.serializeDate=="function"?_.serializeDate:m.serializeDate,skipNulls:typeof _.skipNulls=="boolean"?_.skipNulls:m.skipNulls,sort:typeof _.sort=="function"?_.sort:null,strictNullHandling:typeof _.strictNullHandling=="boolean"?_.strictNullHandling:m.strictNullHandling}};return stringify_1=function(y,_){var b=y,x=v(_),w,S;typeof x.filter=="function"?(S=x.filter,b=S("",b)):a(x.filter)&&(S=x.filter,w=S);var T=[];if(typeof b!="object"||b===null)return"";var E=i[x.arrayFormat],M=E==="comma"&&x.commaRoundTrip;w||(w=Object.keys(b)),x.sort&&w.sort(x.sort);for(var P=r(),A=0;A0?j+k:""},stringify_1}var parse,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse;hasRequiredParse=1;var r=requireUtils(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(o){return o.replace(/&#(\d+);/g,function(c,v){return String.fromCharCode(parseInt(v,10))})},a=function(o,c){return o&&typeof o=="string"&&c.comma&&o.indexOf(",")>-1?o.split(","):o},l="utf8=%26%2310003%3B",u="utf8=%E2%9C%93",d=function(c,v){var y={__proto__:null},_=v.ignoreQueryPrefix?c.replace(/^\?/,""):c;_=_.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var b=v.parameterLimit===1/0?void 0:v.parameterLimit,x=_.split(v.delimiter,b),w=-1,S,T=v.charset;if(v.charsetSentinel)for(S=0;S-1&&(C=t(C)?[C]:C);var D=e.call(y,A);D&&v.duplicates==="combine"?y[A]=r.combine(y[A],C):(!D||v.duplicates==="last")&&(y[A]=C)}return y},f=function(o,c,v,y){for(var _=y?c:a(c,v),b=o.length-1;b>=0;--b){var x,w=o[b];if(w==="[]"&&v.parseArrays)x=v.allowEmptyArrays&&(_===""||v.strictNullHandling&&_===null)?[]:[].concat(_);else{x=v.plainObjects?{__proto__:null}:{};var S=w.charAt(0)==="["&&w.charAt(w.length-1)==="]"?w.slice(1,-1):w,T=v.decodeDotInKeys?S.replace(/%2E/g,"."):S,E=parseInt(T,10);!v.parseArrays&&T===""?x={0:_}:!isNaN(E)&&w!==T&&String(E)===T&&E>=0&&v.parseArrays&&E<=v.arrayLimit?(x=[],x[E]=_):T!=="__proto__"&&(x[T]=_)}_=x}return _},m=function(c,v,y,_){if(c){var b=y.allowDots?c.replace(/\.([^.[]+)/g,"[$1]"):c,x=/(\[[^[\]]*])/,w=/(\[[^[\]]*])/g,S=y.depth>0&&x.exec(b),T=S?b.slice(0,S.index):b,E=[];if(T){if(!y.plainObjects&&e.call(Object.prototype,T)&&!y.allowPrototypes)return;E.push(T)}for(var M=0;y.depth>0&&(S=w.exec(b))!==null&&M"u"?n.charset:c.charset,y=typeof c.duplicates>"u"?n.duplicates:c.duplicates;if(y!=="combine"&&y!=="first"&&y!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var _=typeof c.allowDots>"u"?c.decodeDotInKeys===!0?!0:n.allowDots:!!c.allowDots;return{allowDots:_,allowEmptyArrays:typeof c.allowEmptyArrays=="boolean"?!!c.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof c.allowPrototypes=="boolean"?c.allowPrototypes:n.allowPrototypes,allowSparse:typeof c.allowSparse=="boolean"?c.allowSparse:n.allowSparse,arrayLimit:typeof c.arrayLimit=="number"?c.arrayLimit:n.arrayLimit,charset:v,charsetSentinel:typeof c.charsetSentinel=="boolean"?c.charsetSentinel:n.charsetSentinel,comma:typeof c.comma=="boolean"?c.comma:n.comma,decodeDotInKeys:typeof c.decodeDotInKeys=="boolean"?c.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof c.decoder=="function"?c.decoder:n.decoder,delimiter:typeof c.delimiter=="string"||r.isRegExp(c.delimiter)?c.delimiter:n.delimiter,depth:typeof c.depth=="number"||c.depth===!1?+c.depth:n.depth,duplicates:y,ignoreQueryPrefix:c.ignoreQueryPrefix===!0,interpretNumericEntities:typeof c.interpretNumericEntities=="boolean"?c.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof c.parameterLimit=="number"?c.parameterLimit:n.parameterLimit,parseArrays:c.parseArrays!==!1,plainObjects:typeof c.plainObjects=="boolean"?c.plainObjects:n.plainObjects,strictDepth:typeof c.strictDepth=="boolean"?!!c.strictDepth:n.strictDepth,strictNullHandling:typeof c.strictNullHandling=="boolean"?c.strictNullHandling:n.strictNullHandling}};return parse=function(o,c){var v=s(c);if(o===""||o===null||typeof o>"u")return v.plainObjects?{__proto__:null}:{};for(var y=typeof o=="string"?d(o,v):o,_=v.plainObjects?{__proto__:null}:{},b=Object.keys(y),x=0;x",'"',"`"," ","\r",` -`," "],l=["{","}","|","\\","^","`"].concat(a),u=["'"].concat(l),d=["%","/","?",";","#"].concat(u),f=["/","?","#"],m=255,s=/^[+a-z0-9A-Z_-]{0,63}$/,o=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,c={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=requireLib();function b(T,E,M){if(T&&typeof T=="object"&&T instanceof e)return T;var P=new e;return P.parse(T,E,M),P}e.prototype.parse=function(T,E,M){if(typeof T!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof T);var P=T.indexOf("?"),A=P!==-1&&P127?We+="x":We+=fe[ft];if(!We.match(s)){var G=z.slice(0,H),K=z.slice(H+1),ue=fe.match(o);ue&&(G.push(ue[1]),K.unshift(ue[2])),K.length&&(k="/"+K.join(".")+k),this.hostname=G.join(".");break}}}this.hostname.length>m?this.hostname="":this.hostname=this.hostname.toLowerCase(),Z||(this.hostname=r.toASCII(this.hostname));var ke=this.port?":"+this.port:"",Ie=this.hostname||"";this.host=Ie+ke,this.href+=this.host,Z&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!c[W])for(var H=0,_e=u.length;H<_e;H++){var F=u[H];if(k.indexOf(F)!==-1){var ge=encodeURIComponent(F);ge===F&&(ge=escape(F)),k=k.split(F).join(ge)}}var le=k.indexOf("#");le!==-1&&(this.hash=k.substr(le),k=k.slice(0,le));var te=k.indexOf("?");if(te!==-1?(this.search=k.substr(te),this.query=k.substr(te+1),E&&(this.query=_.parse(this.query)),k=k.slice(0,te)):E&&(this.search="",this.query={}),k&&(this.pathname=k),y[W]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ke=this.pathname||"",oe=this.search||"";this.path=ke+oe}return this.href=this.format(),this};function x(T){return typeof T=="string"&&(T=b(T)),T instanceof e?T.format():e.prototype.format.call(T)}e.prototype.format=function(){var T=this.auth||"";T&&(T=encodeURIComponent(T),T=T.replace(/%3A/i,":"),T+="@");var E=this.protocol||"",M=this.pathname||"",P=this.hash||"",A=!1,C="";this.host?A=T+this.host:this.hostname&&(A=T+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(A+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(C=_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var D=this.search||C&&"?"+C||"";return E&&E.substr(-1)!==":"&&(E+=":"),this.slashes||(!E||y[E])&&A!==!1?(A="//"+(A||""),M&&M.charAt(0)!=="/"&&(M="/"+M)):A||(A=""),P&&P.charAt(0)!=="#"&&(P="#"+P),D&&D.charAt(0)!=="?"&&(D="?"+D),M=M.replace(/[?#]/g,function(k){return encodeURIComponent(k)}),D=D.replace("#","%23"),E+A+M+D+P};function w(T,E){return b(T,!1,!0).resolve(E)}e.prototype.resolve=function(T){return this.resolveObject(b(T,!1,!0)).format()};function S(T,E){return T?b(T,!1,!0).resolveObject(E):E}return e.prototype.resolveObject=function(T){if(typeof T=="string"){var E=new e;E.parse(T,!1,!0),T=E}for(var M=new e,P=Object.keys(this),A=0;A0?M.host.split("@"):!1;We&&(M.auth=We.shift(),M.hostname=We.shift(),M.host=M.hostname)}return M.search=T.search,M.query=T.query,(M.pathname!==null||M.search!==null)&&(M.path=(M.pathname?M.pathname:"")+(M.search?M.search:"")),M.href=M.format(),M}if(!z.length)return M.pathname=null,M.search?M.path="/"+M.search:M.path=null,M.href=M.format(),M;for(var ft=z.slice(-1)[0],Te=(M.host||T.host||z.length>1)&&(ft==="."||ft==="..")||ft==="",G=0,K=z.length;K>=0;K--)ft=z[K],ft==="."?z.splice(K,1):ft===".."?(z.splice(K,1),G++):G&&(z.splice(K,1),G--);if(!X&&!Z)for(;G--;G)z.unshift("..");X&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/")&&z.unshift(""),Te&&z.join("/").substr(-1)!=="/"&&z.push("");var ue=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(fe){M.hostname=ue?"":z.length?z.shift():"",M.host=M.hostname;var We=M.host&&M.host.indexOf("@")>0?M.host.split("@"):!1;We&&(M.auth=We.shift(),M.hostname=We.shift(),M.host=M.hostname)}return X=X||M.host&&z.length,X&&!ue&&z.unshift(""),z.length>0?M.pathname=z.join("/"):(M.pathname=null,M.path=null),(M.pathname!==null||M.search!==null)&&(M.path=(M.pathname?M.pathname:"")+(M.search?M.search:"")),M.auth=T.auth||M.auth,M.slashes=M.slashes||T.slashes,M.href=M.format(),M},e.prototype.parseHost=function(){var T=this.host,E=n.exec(T);E&&(E=E[0],E!==":"&&(this.port=E.substr(1)),T=T.substr(0,T.length-E.length)),T&&(this.hostname=T)},url$1.parse=b,url$1.resolve=w,url$1.resolveObject=S,url$1.format=x,url$1.Url=e,url$1}var urlExports=requireUrl();/*! - * @pixi/utils - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/utils is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */var url={parse:urlExports.parse,format:urlExports.format,resolve:urlExports.resolve};settings.RETINA_PREFIX=/@([0-9\.]+)x/;settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var saidHello=!1,VERSION="6.5.10";function sayHello(r){var e;if(!saidHello){if(settings.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[` - %c %c %c PixiJS `+VERSION+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ - -`,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,t)}else globalThis.console&&globalThis.console.log("PixiJS "+VERSION+" - "+r+" - http://www.pixijs.com/");saidHello=!0}}var supported;function isWebGLSupported(){return typeof supported>"u"&&(supported=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!settings.ADAPTER.getWebGLRenderingContext())return!1;var t=settings.ADAPTER.createCanvas(),n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),i=!!(n&&n.getContextAttributes().stencil);if(n){var a=n.getExtension("WEBGL_lose_context");a&&a.loseContext()}return n=null,i}catch{return!1}}()),supported}function hex2rgb(r,e){return e===void 0&&(e=[]),e[0]=(r>>16&255)/255,e[1]=(r>>8&255)/255,e[2]=(r&255)/255,e}function hex2string(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function rgb2hex(r){return(r[0]*255<<16)+(r[1]*255<<8)+(r[2]*255|0)}function mapPremultipliedBlendModes(){for(var r=[],e=[],t=0;t<32;t++)r[t]=t,e[t]=t;r[BLEND_MODES.NORMAL_NPM]=BLEND_MODES.NORMAL,r[BLEND_MODES.ADD_NPM]=BLEND_MODES.ADD,r[BLEND_MODES.SCREEN_NPM]=BLEND_MODES.SCREEN,e[BLEND_MODES.NORMAL]=BLEND_MODES.NORMAL_NPM,e[BLEND_MODES.ADD]=BLEND_MODES.ADD_NPM,e[BLEND_MODES.SCREEN]=BLEND_MODES.SCREEN_NPM;var n=[];return n.push(e),n.push(r),n}var premultiplyBlendMode=mapPremultipliedBlendModes();function premultiplyTint(r,e){if(e===1)return(e*255<<24)+r;if(e===0)return 0;var t=r>>16&255,n=r>>8&255,i=r&255;return t=t*e+.5|0,n=n*e+.5|0,i=i*e+.5|0,(e*255<<24)+(t<<16)+(n<<8)+i}function getBufferType(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function nextPow2(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function isPow2(r){return!(r&r-1)&&!!r}function log2(r){var e=(r>65535?1:0)<<4;r>>>=e;var t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function removeItems(r,e,t){var n=r.length,i;if(!(e>=n||t===0)){t=e+t>n?n-e:t;var a=n-t;for(i=e;i"u"?console.warn("PixiJS Deprecation Warning: ",e+` -Deprecated since v`+r):(n=n.split(` -`).splice(t).join(` -`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+` -Deprecated since v`+r),console.warn(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+` -Deprecated since v`+r),console.warn(n))),warnings[e]=!0}}var ProgramCache={},TextureCache=Object.create(null),BaseTextureCache=Object.create(null);(function(){function r(e,t,n){this.canvas=settings.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=n||settings.RESOLUTION,this.resize(e,t)}return r.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},r.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},r.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),r})();var tempAnchor;function determineCrossOrigin(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,tempAnchor||(tempAnchor=document.createElement("a")),tempAnchor.href=r;var t=url.parse(tempAnchor.href),n=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!n||t.protocol!==e.protocol?"anonymous":""}function getResolutionOfUrl(r,e){var t=settings.RETINA_PREFIX.exec(r);return t?parseFloat(t[1]):e!==void 0?e:1}/*! - * @pixi/extensions - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/extensions is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var __assign$2=function(){return __assign$2=Object.assign||function(e){for(var t=arguments,n,i=1,a=arguments.length;i8)throw new Error("max arguments reached");var f=this,m=f.name,s=f.items;this._aliasCount++;for(var o=0,c=s.length;o0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},r.prototype.remove=function(e){var t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this},r.prototype.contains=function(e){return this.items.indexOf(e)!==-1},r.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},r.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(r.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r}();Object.defineProperties(Runner.prototype,{dispatch:{value:Runner.prototype.emit},run:{value:Runner.prototype.emit}});/*! - * @pixi/ticker - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/ticker is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */settings.TARGET_FPMS=.06;var UPDATE_PRIORITY;(function(r){r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY"})(UPDATE_PRIORITY||(UPDATE_PRIORITY={}));var TickerListener=function(){function r(e,t,n,i){t===void 0&&(t=null),n===void 0&&(n=0),i===void 0&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=n,this.once=i}return r.prototype.match=function(e,t){return t===void 0&&(t=null),this.fn===e&&this.context===t},r.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t},r.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},r.prototype.destroy=function(e){e===void 0&&(e=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var t=this.next;return this.next=e?null:t,this.previous=null,t},r}(),Ticker=function(){function r(){var e=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new TickerListener(null,null,1/0),this.deltaMS=1/settings.TARGET_FPMS,this.elapsedMS=1/settings.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&e._requestId===null&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return r.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},r.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},r.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},r.prototype.add=function(e,t,n){return n===void 0&&(n=UPDATE_PRIORITY.NORMAL),this._addListener(new TickerListener(e,t,n))},r.prototype.addOnce=function(e,t,n){return n===void 0&&(n=UPDATE_PRIORITY.NORMAL),this._addListener(new TickerListener(e,t,n,!0))},r.prototype._addListener=function(e){var t=this._head.next,n=this._head;if(!t)e.connect(n);else{for(;t;){if(e.priority>t.priority){e.connect(n);break}n=t,t=t.next}e.previous||e.connect(n)}return this._startIfPossible(),this},r.prototype.remove=function(e,t){for(var n=this._head.next;n;)n.match(e,t)?n=n.destroy():n=n.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(r.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},r.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},r.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(e){e===void 0&&(e=performance.now());var t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var n=e-this._lastFrame|0;if(n=this.x&&e=this.y&&te.right?e.right:this.right;if(i<=n)return!1;var a=this.ye.bottom?e.bottom:this.bottom;return l>a}var u=this.left,d=this.right,f=this.top,m=this.bottom;if(d<=u||m<=f)return!1;var s=tempPoints$1[0].set(e.left,e.top),o=tempPoints$1[1].set(e.left,e.bottom),c=tempPoints$1[2].set(e.right,e.top),v=tempPoints$1[3].set(e.right,e.bottom);if(c.x<=s.x||o.y<=s.y)return!1;var y=Math.sign(t.a*t.d-t.b*t.c);if(y===0||(t.apply(s,s),t.apply(o,o),t.apply(c,c),t.apply(v,v),Math.max(s.x,o.x,c.x,v.x)<=u||Math.min(s.x,o.x,c.x,v.x)>=d||Math.max(s.y,o.y,c.y,v.y)<=f||Math.min(s.y,o.y,c.y,v.y)>=m))return!1;var _=y*(o.y-s.y),b=y*(s.x-o.x),x=_*u+b*f,w=_*d+b*f,S=_*u+b*m,T=_*d+b*m;if(Math.max(x,w,S,T)<=_*s.x+b*s.y||Math.min(x,w,S,T)>=_*v.x+b*v.y)return!1;var E=y*(s.y-c.y),M=y*(c.x-s.x),P=E*u+M*f,A=E*d+M*f,C=E*u+M*m,D=E*d+M*m;return!(Math.max(P,A,C,D)<=E*s.x+M*s.y||Math.min(P,A,C,D)>=E*v.x+M*v.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),a=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=i,this.height=Math.max(a-i,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var n=Math.ceil((this.x+this.width-t)*e)/e,i=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=i-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),a=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=i,this.height=a-i,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),ObservablePoint=function(){function r(e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=0),this._x=n,this._y=i,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),Matrix=function(){function r(e,t,n,i,a,l){e===void 0&&(e=1),t===void 0&&(t=0),n===void 0&&(n=0),i===void 0&&(i=1),a===void 0&&(a=0),l===void 0&&(l=0),this.array=null,this.a=e,this.b=t,this.c=n,this.d=i,this.tx=a,this.ty=l}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,n,i,a,l){return this.a=e,this.b=t,this.c=n,this.d=i,this.tx=a,this.ty=l,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n},r.prototype.apply=function(e,t){t=t||new Point;var n=e.x,i=e.y;return t.x=this.a*n+this.c*i+this.tx,t.y=this.b*n+this.d*i+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new Point;var n=1/(this.a*this.d+this.c*-this.b),i=e.x,a=e.y;return t.x=this.d*n*i+-this.c*n*a+(this.ty*this.c-this.tx*this.d)*n,t.y=this.a*n*a+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),i=this.a,a=this.c,l=this.tx;return this.a=i*t-this.b*n,this.b=i*n+this.b*t,this.c=a*t-this.d*n,this.d=a*n+this.d*t,this.tx=l*t-this.ty*n,this.ty=l*n+this.ty*t,this},r.prototype.append=function(e){var t=this.a,n=this.b,i=this.c,a=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*n+e.b*a,this.c=e.c*t+e.d*i,this.d=e.c*n+e.d*a,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*n+e.ty*a+this.ty,this},r.prototype.setTransform=function(e,t,n,i,a,l,u,d,f){return this.a=Math.cos(u+f)*a,this.b=Math.sin(u+f)*a,this.c=-Math.sin(u-d)*l,this.d=Math.cos(u-d)*l,this.tx=e-(n*this.a+i*this.c),this.ty=t-(n*this.b+i*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var n=this.a,i=this.c;this.a=n*e.a+this.b*e.c,this.b=n*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,n=this.b,i=this.c,a=this.d,l=e.pivot,u=-Math.atan2(-i,a),d=Math.atan2(n,t),f=Math.abs(u+d);return f<1e-5||Math.abs(PI_2-f)<1e-5?(e.rotation=d,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=u,e.skew.y=d),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(i*i+a*a),e.position.x=this.tx+(l.x*t+l.y*i),e.position.y=this.ty+(l.x*n+l.y*a),e},r.prototype.invert=function(){var e=this.a,t=this.b,n=this.c,i=this.d,a=this.tx,l=e*i-t*n;return this.a=i/l,this.b=-t/l,this.c=-n/l,this.d=e/l,this.tx=(n*this.ty-i*a)/l,this.ty=-(e*this.ty-t*a)/l,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),ux=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],uy=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vx=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vy=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],rotationCayley=[],rotationMatrices=[],signum=Math.sign;function init(){for(var r=0;r<16;r++){var e=[];rotationCayley.push(e);for(var t=0;t<16;t++)for(var n=signum(ux[r]*ux[t]+vx[r]*uy[t]),i=signum(uy[r]*ux[t]+vy[r]*uy[t]),a=signum(ux[r]*vx[t]+vx[r]*vy[t]),l=signum(uy[r]*vx[t]+vy[r]*vy[t]),u=0;u<16;u++)if(ux[u]===n&&uy[u]===i&&vx[u]===a&&vy[u]===l){e.push(u);break}}for(var r=0;r<16;r++){var d=new Matrix;d.set(ux[r],uy[r],vx[r],vy[r],0,0),rotationMatrices.push(d)}}init();var groupD8={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(r){return ux[r]},uY:function(r){return uy[r]},vX:function(r){return vx[r]},vY:function(r){return vy[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return rotationCayley[r][e]},sub:function(r,e){return rotationCayley[r][groupD8.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?groupD8.S:groupD8.N:Math.abs(e)*2<=Math.abs(r)?r>0?groupD8.E:groupD8.W:e>0?r>0?groupD8.SE:groupD8.SW:r>0?groupD8.NE:groupD8.NW},matrixAppendRotationInv:function(r,e,t,n){t===void 0&&(t=0),n===void 0&&(n=0);var i=rotationMatrices[groupD8.inv(e)];i.tx=t,i.ty=n,r.append(i)}},Transform=function(){function r(){this.worldTransform=new Matrix,this.localTransform=new Matrix,this.position=new ObservablePoint(this.onChange,this,0,0),this.scale=new ObservablePoint(this.onChange,this,1,1),this.pivot=new ObservablePoint(this.onChange,this,0,0),this.skew=new ObservablePoint(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},r.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){var n=e.worldTransform,i=this.worldTransform;i.a=t.a*n.a+t.b*n.c,i.b=t.a*n.b+t.b*n.d,i.c=t.c*n.a+t.d*n.c,i.d=t.c*n.b+t.d*n.d,i.tx=t.tx*n.a+t.ty*n.c+n.tx,i.ty=t.tx*n.b+t.ty*n.d+n.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();/*! - * @pixi/core - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/core is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */settings.PREFER_ENV=isMobile.any?ENV.WEBGL:ENV.WEBGL2;settings.STRICT_TEXTURE_CACHE=!1;var INSTALLED=[];function autoDetectResource(r,e){if(!r)return null;var t="";if(typeof r=="string"){var n=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);n&&(t=n[1].toLowerCase())}for(var i=INSTALLED.length-1;i>=0;--i){var a=INSTALLED[i];if(a.test&&a.test(r,t))return new a(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$z=function(r,e){return extendStatics$z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},extendStatics$z(r,e)};function __extends$z(r,e){extendStatics$z(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var __assign$1=function(){return __assign$1=Object.assign||function(e){for(var t=arguments,n,i=1,a=arguments.length;i0&&m>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(t),i}return Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,n){var i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),n!==void 0&&n!==this.mipmap&&(this.mipmap=n,i=!0),i&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,n,i){return i=i||this.resolution,this.setRealSize(t*i,n*i,i)},e.prototype.setRealSize=function(t,n,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(n)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=isPow2(this.realWidth)&&isPow2(this.realHeight)},e.prototype.setResolution=function(t){var n=this.resolution;return n===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*n)/t,this.height=Math.round(this.height*n)/t,this.emit("update",this)),this._refreshPOT(),this)},e.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete BaseTextureCache[this.cacheId],delete TextureCache[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,n,i){i===void 0&&(i=settings.STRICT_TEXTURE_CACHE);var a=typeof t=="string",l=null;if(a)l=t;else{if(!t._pixiId){var u=n&&n.pixiIdPrefix||"pixiid";t._pixiId=u+"_"+uid()}l=t._pixiId}var d=BaseTextureCache[l];if(a&&i&&!d)throw new Error('The cacheId "'+l+'" does not exist in BaseTextureCache.');return d||(d=new e(t,n),d.cacheId=l,e.addToCache(d,l)),d},e.fromBuffer=function(t,n,i,a){t=t||new Float32Array(n*i*4);var l=new BufferResource(t,{width:n,height:i}),u=t instanceof Float32Array?TYPES.FLOAT:TYPES.UNSIGNED_BYTE;return new e(l,Object.assign({},defaultBufferOptions,a||{width:n,height:i,type:u}))},e.addToCache=function(t,n){n&&(t.textureCacheIds.indexOf(n)===-1&&t.textureCacheIds.push(n),BaseTextureCache[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),BaseTextureCache[n]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var n=BaseTextureCache[t];if(n){var i=n.textureCacheIds.indexOf(t);return i>-1&&n.textureCacheIds.splice(i,1),delete BaseTextureCache[t],n}}else if(t&&t.textureCacheIds){for(var a=0;a0)if(t.resource)this.addResourceAt(t.resource,n);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+n,t.parentTextureArray=this.baseTexture,this.items[n]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[n]=t,this},e.prototype.upload=function(t,n,i){for(var a=this.itemDirtyIds,l=0;l)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(BaseImageResource),VideoResource=function(r){__extends$z(e,r);function e(t,n){var i=this;if(n=n||{},!(t instanceof HTMLVideoElement)){var a=document.createElement("video");a.setAttribute("preload","auto"),a.setAttribute("webkit-playsinline",""),a.setAttribute("playsinline",""),typeof t=="string"&&(t=[t]);var l=t[0].src||t[0];BaseImageResource.crossOrigin(a,l,n.crossorigin);for(var u=0;u2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var n=this.valid;this.resize(t.videoWidth,t.videoHeight),!n&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),r.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,n){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(n)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(BaseImageResource),ImageBitmapResource=function(r){__extends$z(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&t instanceof ImageBitmap},e}(BaseImageResource);INSTALLED.push(ImageResource,ImageBitmapResource,CanvasResource,VideoResource,SVGResource,BufferResource,CubeResource,ArrayResource);var DepthResource=function(r){__extends$z(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.upload=function(t,n,i){var a=t.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===ALPHA_MODES$1.UNPACK);var l=n.realWidth,u=n.realHeight;return i.width===l&&i.height===u?a.texSubImage2D(n.target,0,0,0,l,u,n.format,i.type,this.data):(i.width=l,i.height=u,a.texImage2D(n.target,0,i.internalFormat,l,u,0,n.format,i.type,this.data)),!0},e}(BufferResource),Framebuffer=function(){function r(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Runner("disposeFramebuffer"),this.multisample=MSAA_QUALITY.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(e,t){return e===void 0&&(e=0),this.colorTextures[e]=t||new BaseTexture(null,{scaleMode:SCALE_MODES.NEAREST,resolution:1,mipmap:MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new BaseTexture(new DepthResource(null,{width:this.width,height:this.height}),{scaleMode:SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:MIPMAP_MODES.OFF,format:FORMATS.DEPTH_COMPONENT,type:TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var n=0;n-1&&n.textureCacheIds.splice(i,1),delete TextureCache[t],n}}else if(t&&t.textureCacheIds){for(var a=0;athis.baseTexture.width,d=i+l>this.baseTexture.height;if(u||d){var f=u&&d?"and":"or",m="X: "+n+" + "+a+" = "+(n+a)+" > "+this.baseTexture.width,s="Y: "+i+" + "+l+" = "+(i+l)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(m+" "+f+" "+s))}this.valid=a&&l&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new BaseTexture),removeAllHandlers(e._EMPTY),removeAllHandlers(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=settings.ADAPTER.createCanvas(16,16),n=t.getContext("2d");t.width=16,t.height=16,n.fillStyle="white",n.fillRect(0,0,16,16),e._WHITE=new e(BaseTexture.from(t)),removeAllHandlers(e._WHITE),removeAllHandlers(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(EventEmitter),RenderTexture=function(r){__extends$z(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,n,i){i===void 0&&(i=!0);var a=this.baseTexture.resolution,l=Math.round(t*a)/a,u=Math.round(n*a)/a;this.valid=l>0&&u>0,this._frame.width=this.orig.width=l,this._frame.height=this.orig.height=u,i&&this.baseTexture.resize(l,u),this.updateUvs()},e.prototype.setResolution=function(t){var n=this.baseTexture;n.resolution!==t&&(n.setResolution(t),this.resize(n.width,n.height,!1))},e.create=function(t){for(var n=arguments,i=[],a=1;a>>0,i>1&&(a+=i*4294967296)):a=i>1?-i:-1,this.texturePool[a]||(this.texturePool[a]=[]);var l=this.texturePool[a].pop();return l||(l=this.createTexture(e,t,i)),l.filterPoolKey=a,l.setResolution(n),l},r.prototype.getFilterTexture=function(e,t,n){var i=this.getOptimalTexture(e.width,e.height,t||e.resolution,n||MSAA_QUALITY.NONE);return i.filterFrame=e.filterFrame,i},r.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},r.prototype.returnFilterTexture=function(e){this.returnTexture(e)},r.prototype.clear=function(e){if(e=e!==!1,e)for(var t in this.texturePool){var n=this.texturePool[t];if(n)for(var i=0;i0&&e.height>0;for(var t in this.texturePool)if(Number(t)<0){var n=this.texturePool[t];if(n)for(var i=0;i1){for(var m=0;m1&&(s=this.getOptimalFilterTexture(m.width,m.height,t.resolution),s.filterFrame=m.filterFrame),n[o].apply(this,m,s,CLEAR_MODES.CLEAR,t);var c=m;m=s,s=c}n[o].apply(this,m,f.renderTexture,CLEAR_MODES.BLEND,t),o>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(m),this.returnFilterTexture(s)}t.clear(),this.statePool.push(t)},r.prototype.bindAndClear=function(e,t){t===void 0&&(t=CLEAR_MODES.CLEAR);var n=this.renderer,i=n.renderTexture,a=n.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var l=this.tempRect;l.x=0,l.y=0,l.width=e.filterFrame.width,l.height=e.filterFrame.height,i.bind(e,e.filterFrame,l)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var u=a.stateId&1||this.forceClear;(t===CLEAR_MODES.CLEAR||t===CLEAR_MODES.BLIT&&u)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(e,t,n,i){var a=this.renderer;a.state.set(e.state),this.bindAndClear(n,i),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,a.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),a.geometry.bind(this.quadUv),a.geometry.draw(DRAW_MODES.TRIANGLES)):(a.geometry.bind(this.quad),a.geometry.draw(DRAW_MODES.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(e,t){var n=this.activeState,i=n.sourceFrame,a=n.destinationFrame,l=t._texture.orig,u=e.set(a.width,0,0,a.height,i.x,i.y),d=t.worldTransform.copyTo(Matrix.TEMP_MATRIX);return d.invert(),u.prepend(d),u.scale(1/l.width,1/l.height),u.translate(t.anchor.x,t.anchor.y),u},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(e,t,n,i){return n===void 0&&(n=1),i===void 0&&(i=MSAA_QUALITY.NONE),this.texturePool.getOptimalTexture(e,t,n,i)},r.prototype.getFilterTexture=function(e,t,n){if(typeof e=="number"){var i=e;e=t,t=i}e=e||this.activeState.renderTexture;var a=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,n||MSAA_QUALITY.NONE);return a.filterFrame=e.filterFrame,a},r.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(e,t){var n=tempPoints[0],i=tempPoints[1],a=tempPoints[2],l=tempPoints[3];n.set(t.left,t.top),i.set(t.left,t.bottom),a.set(t.right,t.top),l.set(t.right,t.bottom),e.apply(n,n),e.apply(i,i),e.apply(a,a),e.apply(l,l);var u=Math.min(n.x,i.x,a.x,l.x),d=Math.min(n.y,i.y,a.y,l.y),f=Math.max(n.x,i.x,a.x,l.x),m=Math.max(n.y,i.y,a.y,l.y);t.x=u,t.y=d,t.width=f-u,t.height=m-d},r.prototype.roundFrame=function(e,t,n,i,a){if(!(e.width<=0||e.height<=0||n.width<=0||n.height<=0)){if(a){var l=a.a,u=a.b,d=a.c,f=a.d;if((Math.abs(u)>1e-4||Math.abs(d)>1e-4)&&(Math.abs(l)>1e-4||Math.abs(f)>1e-4))return}a=a?tempMatrix$2.copyFrom(a):tempMatrix$2.identity(),a.translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(a,e),e.ceil(t),this.transformAABB(a.invert(),e)}},r}(),ObjectRenderer=function(){function r(e){this.renderer=e}return r.prototype.flush=function(){},r.prototype.destroy=function(){this.renderer=null},r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.render=function(e){},r}(),BatchSystem=function(){function r(e){this.renderer=e,this.emptyRenderer=new ObjectRenderer(e),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(e,t){for(var n=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=n[i]||null,e[i]&&(e[i]._batchLocation=i)},r.prototype.boundArray=function(e,t,n,i){for(var a=e.elements,l=e.ids,u=e.count,d=0,f=0;f=0&&s=ENV.WEBGL2&&(n=e.getContext("webgl2",t)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!n)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){var t=this;e.preventDefault(),setTimeout(function(){t.gl.isContextLost()&&t.extensions.loseContext&&t.extensions.loseContext.restoreContext()},0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),n="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),GLFramebuffer=function(){function r(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),tempRectangle=new Rectangle,FramebufferSystem=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Framebuffer(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Rectangle,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var t=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;settings.PREFER_ENV===ENV.WEBGL_LEGACY&&(t=null,n=null),t?e.drawBuffers=function(i){return t.drawBuffersWEBGL(i)}:(this.hasMRT=!1,e.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(e,t,n){n===void 0&&(n=0);var i=this.gl;if(e){var a=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,a.framebuffer)),a.mipLevel!==n&&(e.dirtyId++,e.dirtyFormat++,a.mipLevel=n),a.dirtyId!==e.dirtyId&&(a.dirtyId=e.dirtyId,a.dirtyFormat!==e.dirtyFormat?(a.dirtyFormat=e.dirtyFormat,a.dirtySize=e.dirtySize,this.updateFramebuffer(e,n)):a.dirtySize!==e.dirtySize&&(a.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var l=0;l>n,f=t.height>>n,m=d/t.width;this.setViewport(t.x*m,t.y*m,d,f)}else{var d=e.width>>n,f=e.height>>n;this.setViewport(0,0,d,f)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,n,i){var a=this.viewport;e=Math.round(e),t=Math.round(t),n=Math.round(n),i=Math.round(i),(a.width!==n||a.height!==i||a.x!==e||a.y!==t)&&(a.x=e,a.y=t,a.width=n,a.height=i,this.gl.viewport(e,t,n,i))},Object.defineProperty(r.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,t,n,i,a){a===void 0&&(a=BUFFER_BITS.COLOR|BUFFER_BITS.DEPTH);var l=this.gl;l.clearColor(e,t,n,i),l.clear(a)},r.prototype.initFramebuffer=function(e){var t=this.gl,n=new GLFramebuffer(t.createFramebuffer());return n.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(e),e.disposeRunner.add(this),n},r.prototype.resizeFramebuffer=function(e){var t=this.gl,n=e.glFramebuffers[this.CONTEXT_UID];n.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,n.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.RGBA8,e.width,e.height)),n.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,n.stencil),n.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var i=e.colorTextures,a=i.length;t.drawBuffers||(a=Math.min(a,1));for(var l=0;l1&&this.canMultisampleFramebuffer(e)?(i.msaaBuffer=i.msaaBuffer||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.RGBA8,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(n.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var u=[],d=0;d1&&n.drawBuffers(u),e.depthTexture){var s=this.writeDepthTexture;if(s){var o=e.depthTexture;this.renderer.texture.bind(o,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,o._glTextures[this.CONTEXT_UID].texture,t)}}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(i.stencil=i.stencil||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.stencil),i.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.DEPTH24_STENCIL8,e.width,e.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,i.stencil)):i.stencil&&(n.deleteRenderbuffer(i.stencil),i.stencil=null)},r.prototype.canMultisampleFramebuffer=function(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var t=this.msaaSamples,n=MSAA_QUALITY.NONE;if(e<=1||t===null)return n;for(var i=0;i=0&&this.managedFramebuffers.splice(a,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(n.framebuffer),n.msaaBuffer&&i.deleteRenderbuffer(n.msaaBuffer),n.stencil&&i.deleteRenderbuffer(n.stencil)),n.blitFramebuffer&&n.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n=ENV.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),context=e}return context}var maxFragmentPrecision;function getMaxFragmentPrecision(){if(!maxFragmentPrecision){maxFragmentPrecision=PRECISION.MEDIUM;var r=getTestContext();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);maxFragmentPrecision=e.precision?PRECISION.HIGH:PRECISION.MEDIUM}}return maxFragmentPrecision}function setPrecision(r,e,t){if(r.substring(0,9)!=="precision"){var n=e;return e===PRECISION.HIGH&&t!==PRECISION.HIGH&&(n=PRECISION.MEDIUM),"precision "+n+` float; -`+r}else if(t!==PRECISION.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var GLSL_TO_SIZE={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function mapSize(r){return GLSL_TO_SIZE[r]}var GL_TABLE=null,GL_TO_GLSL_TYPES={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function mapType(r,e){if(!GL_TABLE){var t=Object.keys(GL_TO_GLSL_TYPES);GL_TABLE={};for(var n=0;n0&&(e+=` -else `),t"u"?.5:t,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(e,t){t===void 0&&(t=e);for(var n=this.mapCoord,i=0;i0?this.maskStack[this.maskStack.length-1]._colorMask:15;n!==t&&this.renderer.gl.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)},r.prototype.destroy=function(){this.renderer=null},r}(),AbstractMaskSystem=function(){function r(e){this.renderer=e,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(e){var t=this.renderer.gl,n=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==n&&(i===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),tempMatrix$1$1=new Matrix,rectPool=[],ScissorSystem=function(r){__extends$z(e,r);function e(t){var n=r.call(this,t)||this;return n.glConst=settings.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,n}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var n;if(!t._scissorRectLocal){var i=t._scissorRect,a=t.maskObject,l=this.renderer,u=l.renderTexture,d=a.getBounds(!0,(n=rectPool.pop())!==null&&n!==void 0?n:new Rectangle);this.roundFrameToPixels(d,u.current?u.current.resolution:l.resolution,u.sourceFrame,u.destinationFrame,l.projection.transform),i&&d.fit(i),t._scissorRectLocal=d}},e.isMatrixRotated=function(t){if(!t)return!1;var n=t.a,i=t.b,a=t.c,l=t.d;return(Math.abs(i)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4)},e.prototype.testScissor=function(t){var n=t.maskObject;if(!n.isFastRect||!n.isFastRect()||e.isMatrixRotated(n.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var i=t._scissorRectLocal;return i.width>0&&i.height>0},e.prototype.roundFrameToPixels=function(t,n,i,a,l){e.isMatrixRotated(l)||(l=l?tempMatrix$1$1.copyFrom(l):tempMatrix$1$1.identity(),l.translate(-i.x,-i.y).scale(a.width/i.width,a.height/i.height).translate(a.x,a.y),this.renderer.filter.transformAABB(l,t),t.fit(a),t.x=Math.round(t.x*n),t.y=Math.round(t.y*n),t.width=Math.round(t.width*n),t.height=Math.round(t.height*n))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var n=this.renderer.gl;t._scissorRect||n.enable(n.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var n=this.renderer.gl;t&&rectPool.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():n.disable(n.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,n;this.renderer.renderTexture.current?n=t.y:n=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,n,t.width,t.height)},e}(AbstractMaskSystem),StencilSystem=function(r){__extends$z(e,r);function e(t){var n=r.call(this,t)||this;return n.glConst=settings.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,n}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var n=t.maskObject,i=this.renderer.gl,a=t._stencilCounter;a===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;var l=t._colorMask;l!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,a,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),n.renderable=!0,n.render(this.renderer),this.renderer.batch.flush(),n.renderable=!1,l!==0&&(t._colorMask=l,i.colorMask((l&1)!==0,(l&2)!==0,(l&4)!==0,(l&8)!==0)),this._useCurrent()},e.prototype.pop=function(t){var n=this.renderer.gl;if(this.getStackLength()===0)n.disable(n.STENCIL_TEST);else{var i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,a=i?i._colorMask:15;a!==0&&(i._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilOp(n.KEEP,n.KEEP,n.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,a!==0&&(i._colorMask=a,n.colorMask((a&1)!==0,(a&2)!==0,(a&4)!==0,(a&8)!==0)),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(AbstractMaskSystem),ProjectionSystem=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Matrix,this.transform=null}return r.prototype.update=function(e,t,n,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,n,i),this.transform&&this.projectionMatrix.append(this.transform);var a=this.renderer;a.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,a.globalUniforms.update(),a.shader.shader&&a.shader.syncUniformGroup(a.shader.shader.uniforms.globals)},r.prototype.calculateProjection=function(e,t,n,i){var a=this.projectionMatrix,l=i?-1:1;a.identity(),a.a=1/t.width*2,a.d=l*(1/t.height*2),a.tx=-1-t.x*a.a,a.ty=-l-t.y*a.d},r.prototype.setTransform=function(e){},r.prototype.destroy=function(){this.renderer=null},r}(),tempRect=new Rectangle,tempRect2=new Rectangle,RenderTextureSystem=function(){function r(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Rectangle,this.destinationFrame=new Rectangle,this.viewportFrame=new Rectangle}return r.prototype.bind=function(e,t,n){e===void 0&&(e=null);var i=this.renderer;this.current=e;var a,l,u;e?(a=e.baseTexture,u=a.resolution,t||(tempRect.width=e.frame.width,tempRect.height=e.frame.height,t=tempRect),n||(tempRect2.x=e.frame.x,tempRect2.y=e.frame.y,tempRect2.width=t.width,tempRect2.height=t.height,n=tempRect2),l=a.framebuffer):(u=i.resolution,t||(tempRect.width=i.screen.width,tempRect.height=i.screen.height,t=tempRect),n||(n=tempRect,n.width=t.width,n.height=t.height));var d=this.viewportFrame;d.x=n.x*u,d.y=n.y*u,d.width=n.width*u,d.height=n.height*u,e||(d.y=i.view.height-(d.y+d.height)),d.ceil(),this.renderer.framebuffer.bind(l,d),this.renderer.projection.update(n,t,u,!l),e?this.renderer.mask.setMaskStack(a.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(n)},r.prototype.clear=function(e,t){this.current?e=e||this.current.baseTexture.clearColor:e=e||this.clearColor;var n=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,a=n.width!==i.width||n.height!==i.height;if(a){var l=this.viewportFrame,u=l.x,d=l.y,f=l.width,m=l.height;u=Math.round(u),d=Math.round(d),f=Math.round(f),m=Math.round(m),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(u,d,f,m)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),a&&this.renderer.scissor.pop()},r.prototype.resize=function(){this.bind(null)},r.prototype.reset=function(){this.bind(null)},r.prototype.destroy=function(){this.renderer=null},r}();function uboUpdate(r,e,t,n,i){t.buffer.update(i)}var UBO_TO_SINGLE_SETTERS={float:` - data[offset] = v; - `,vec2:` - data[offset] = v[0]; - data[offset+1] = v[1]; - `,vec3:` - data[offset] = v[0]; - data[offset+1] = v[1]; - data[offset+2] = v[2]; - - `,vec4:` - data[offset] = v[0]; - data[offset+1] = v[1]; - data[offset+2] = v[2]; - data[offset+3] = v[3]; - `,mat2:` - data[offset] = v[0]; - data[offset+1] = v[1]; - - data[offset+4] = v[2]; - data[offset+5] = v[3]; - `,mat3:` - data[offset] = v[0]; - data[offset+1] = v[1]; - data[offset+2] = v[2]; - - data[offset + 4] = v[3]; - data[offset + 5] = v[4]; - data[offset + 6] = v[5]; - - data[offset + 8] = v[6]; - data[offset + 9] = v[7]; - data[offset + 10] = v[8]; - `,mat4:` - for(var i = 0; i < 16; i++) - { - data[offset + i] = v[i]; - } - `},GLSL_TO_STD40_SIZE={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function createUBOElements(r){for(var e=r.map(function(d){return{data:d,offset:0,dataLen:0,dirty:0}}),t=0,n=0,i=0,a=0;a1&&(t=Math.max(t,16)*l.data.size),l.dataLen=t,n%t!==0&&n<16){var u=n%t%16;n+=u,i+=u}n+t>16?(i=Math.ceil(i/16)*16,l.offset=i,i+=t,n=t):(l.offset=i,n+=t,i+=t)}return i=Math.ceil(i/16)*16,{uboElements:e,size:i}}function getUBOData(r,e){var t=[];for(var n in r)e[n]&&t.push(e[n]);return t.sort(function(i,a){return i.index-a.index}),t}function generateUniformBufferSync(r,e){if(!r.autoManage)return{size:0,syncFunc:uboUpdate};for(var t=getUBOData(r.uniforms,e),n=createUBOElements(t),i=n.uboElements,a=n.size,l=[` - var v = null; - var v2 = null; - var cv = null; - var t = 0; - var gl = renderer.gl - var index = 0; - var data = buffer.data; - `],u=0;u1){var v=mapSize(d.data.type),y=Math.max(GLSL_TO_STD40_SIZE[d.data.type]/16,1),_=v/y,b=(4-_%4)%4;l.push(` - cv = ud.`+m+`.value; - v = uv.`+m+`; - offset = `+d.offset/4+`; - - t = 0; - - for(var i=0; i < `+d.data.size*y+`; i++) - { - for(var j = 0; j < `+_+`; j++) - { - data[offset++] = v[t++]; - } - offset += `+b+`; - } - - `)}else{var x=UBO_TO_SINGLE_SETTERS[d.data.type];l.push(` - cv = ud.`+m+`.value; - v = uv.`+m+`; - offset = `+d.offset/4+`; - `+x+`; - `)}}return l.push(` - renderer.buffer.update(buffer); - `),{size:a,syncFunc:new Function("ud","uv","renderer","syncData","buffer",l.join(` -`))}}var GLProgram=function(){function r(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return r.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},r}();function getAttributeData(r,e){for(var t={},n=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),i=0;is?1:-1});for(var l=0;l>1,n++;this.stateId=e.data}for(var n=0;nthis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,n=!1,i=0;ithis.maxIdle&&(e.destroyTexture(a,!0),t[i]=null,n=!0)}if(n){for(var l=0,i=0;i=0;i--)this.unload(e.children[i])},r.prototype.destroy=function(){this.renderer=null},r}();function mapTypeAndFormatToInternalFormat(r){var e,t,n,i,a,l,u,d,f,m,s,o,c,v,y,_,b,x,w,S,T,E,M;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?M=(e={},e[TYPES.UNSIGNED_BYTE]=(t={},t[FORMATS.RGBA]=r.RGBA8,t[FORMATS.RGB]=r.RGB8,t[FORMATS.RG]=r.RG8,t[FORMATS.RED]=r.R8,t[FORMATS.RGBA_INTEGER]=r.RGBA8UI,t[FORMATS.RGB_INTEGER]=r.RGB8UI,t[FORMATS.RG_INTEGER]=r.RG8UI,t[FORMATS.RED_INTEGER]=r.R8UI,t[FORMATS.ALPHA]=r.ALPHA,t[FORMATS.LUMINANCE]=r.LUMINANCE,t[FORMATS.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,t),e[TYPES.BYTE]=(n={},n[FORMATS.RGBA]=r.RGBA8_SNORM,n[FORMATS.RGB]=r.RGB8_SNORM,n[FORMATS.RG]=r.RG8_SNORM,n[FORMATS.RED]=r.R8_SNORM,n[FORMATS.RGBA_INTEGER]=r.RGBA8I,n[FORMATS.RGB_INTEGER]=r.RGB8I,n[FORMATS.RG_INTEGER]=r.RG8I,n[FORMATS.RED_INTEGER]=r.R8I,n),e[TYPES.UNSIGNED_SHORT]=(i={},i[FORMATS.RGBA_INTEGER]=r.RGBA16UI,i[FORMATS.RGB_INTEGER]=r.RGB16UI,i[FORMATS.RG_INTEGER]=r.RG16UI,i[FORMATS.RED_INTEGER]=r.R16UI,i[FORMATS.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,i),e[TYPES.SHORT]=(a={},a[FORMATS.RGBA_INTEGER]=r.RGBA16I,a[FORMATS.RGB_INTEGER]=r.RGB16I,a[FORMATS.RG_INTEGER]=r.RG16I,a[FORMATS.RED_INTEGER]=r.R16I,a),e[TYPES.UNSIGNED_INT]=(l={},l[FORMATS.RGBA_INTEGER]=r.RGBA32UI,l[FORMATS.RGB_INTEGER]=r.RGB32UI,l[FORMATS.RG_INTEGER]=r.RG32UI,l[FORMATS.RED_INTEGER]=r.R32UI,l[FORMATS.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,l),e[TYPES.INT]=(u={},u[FORMATS.RGBA_INTEGER]=r.RGBA32I,u[FORMATS.RGB_INTEGER]=r.RGB32I,u[FORMATS.RG_INTEGER]=r.RG32I,u[FORMATS.RED_INTEGER]=r.R32I,u),e[TYPES.FLOAT]=(d={},d[FORMATS.RGBA]=r.RGBA32F,d[FORMATS.RGB]=r.RGB32F,d[FORMATS.RG]=r.RG32F,d[FORMATS.RED]=r.R32F,d[FORMATS.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,d),e[TYPES.HALF_FLOAT]=(f={},f[FORMATS.RGBA]=r.RGBA16F,f[FORMATS.RGB]=r.RGB16F,f[FORMATS.RG]=r.RG16F,f[FORMATS.RED]=r.R16F,f),e[TYPES.UNSIGNED_SHORT_5_6_5]=(m={},m[FORMATS.RGB]=r.RGB565,m),e[TYPES.UNSIGNED_SHORT_4_4_4_4]=(s={},s[FORMATS.RGBA]=r.RGBA4,s),e[TYPES.UNSIGNED_SHORT_5_5_5_1]=(o={},o[FORMATS.RGBA]=r.RGB5_A1,o),e[TYPES.UNSIGNED_INT_2_10_10_10_REV]=(c={},c[FORMATS.RGBA]=r.RGB10_A2,c[FORMATS.RGBA_INTEGER]=r.RGB10_A2UI,c),e[TYPES.UNSIGNED_INT_10F_11F_11F_REV]=(v={},v[FORMATS.RGB]=r.R11F_G11F_B10F,v),e[TYPES.UNSIGNED_INT_5_9_9_9_REV]=(y={},y[FORMATS.RGB]=r.RGB9_E5,y),e[TYPES.UNSIGNED_INT_24_8]=(_={},_[FORMATS.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,_),e[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]=(b={},b[FORMATS.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,b),e):M=(x={},x[TYPES.UNSIGNED_BYTE]=(w={},w[FORMATS.RGBA]=r.RGBA,w[FORMATS.RGB]=r.RGB,w[FORMATS.ALPHA]=r.ALPHA,w[FORMATS.LUMINANCE]=r.LUMINANCE,w[FORMATS.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,w),x[TYPES.UNSIGNED_SHORT_5_6_5]=(S={},S[FORMATS.RGB]=r.RGB,S),x[TYPES.UNSIGNED_SHORT_4_4_4_4]=(T={},T[FORMATS.RGBA]=r.RGBA,T),x[TYPES.UNSIGNED_SHORT_5_5_5_1]=(E={},E[FORMATS.RGBA]=r.RGBA,E),x),M}var GLTexture=function(){function r(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=TYPES.UNSIGNED_BYTE,this.internalFormat=FORMATS.RGBA,this.samplerType=0}return r}(),TextureSystem=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new BaseTexture,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=mapTypeAndFormatToInternalFormat(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var n=0;n=0;--l){var u=n[l];if(u){var d=u._glTextures[a];d.samplerType!==SAMPLER_TYPES.FLOAT&&this.renderer.texture.unbind(u)}}},r.prototype.initTexture=function(e){var t=new GLTexture(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},r.prototype.initTextureType=function(e,t){var n,i;t.internalFormat=(i=(n=this.internalFormats[e.type])===null||n===void 0?void 0:n[e.format])!==null&&i!==void 0?i:e.format,this.webGLVersion===2&&e.type===TYPES.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},r.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var n=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(n,e,t))t.samplerType!==SAMPLER_TYPES.FLOAT&&(this.hasIntegerTextures=!0);else{var i=e.realWidth,a=e.realHeight,l=n.gl;(t.width!==i||t.height!==a||t.dirtyId<0)&&(t.width=i,t.height=a,l.texImage2D(e.target,0,t.internalFormat,i,a,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},r.prototype.destroyTexture=function(e,t){var n=this.gl;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),n.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var i=this.managedTextures.indexOf(e);i!==-1&&removeItems(this.managedTextures,i,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===MIPMAP_MODES.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=WRAP_MODES.CLAMP:t.wrapMode=e.wrapMode,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,t){var n=this.gl;if(t.mipmap&&e.mipmap!==MIPMAP_MODES.ON_MANUAL&&n.generateMipmap(e.target),n.texParameteri(e.target,n.TEXTURE_WRAP_S,t.wrapMode),n.texParameteri(e.target,n.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===SCALE_MODES.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);var i=this.renderer.context.extensions.anisotropicFiltering;if(i&&e.anisotropicLevel>0&&e.scaleMode===SCALE_MODES.LINEAR){var a=Math.min(e.anisotropicLevel,n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));n.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY_EXT,a)}}else n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===SCALE_MODES.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(e.target,n.TEXTURE_MAG_FILTER,e.scaleMode===SCALE_MODES.LINEAR?n.LINEAR:n.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),tempMatrix$3=new Matrix,AbstractRenderer=function(r){__extends$z(e,r);function e(t,n){t===void 0&&(t=RENDERER_TYPE.UNKNOWN);var i=r.call(this)||this;return n=Object.assign({},settings.RENDER_OPTIONS,n),i.options=n,i.type=t,i.screen=new Rectangle(0,0,n.width,n.height),i.view=n.view||settings.ADAPTER.createCanvas(),i.resolution=n.resolution||settings.RESOLUTION,i.useContextAlpha=n.useContextAlpha,i.autoDensity=!!n.autoDensity,i.preserveDrawingBuffer=n.preserveDrawingBuffer,i.clearBeforeRender=n.clearBeforeRender,i._backgroundColor=0,i._backgroundColorRgba=[0,0,0,1],i._backgroundColorString="#000000",i.backgroundColor=n.backgroundColor||i._backgroundColor,i.backgroundAlpha=n.backgroundAlpha,n.transparent!==void 0&&(deprecation("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),i.useContextAlpha=n.transparent,i.backgroundAlpha=n.transparent?0:1),i._lastObjectRendered=null,i.plugins={},i}return e.prototype.initPlugins=function(t){for(var n in t)this.plugins[n]=new t[n](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,n){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(n*this.resolution);var i=this.view.width/this.resolution,a=this.view.height/this.resolution;this.screen.width=i,this.screen.height=a,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=a+"px"),this.emit("resize",i,a)},e.prototype.generateTexture=function(t,n,i,a){n===void 0&&(n={}),typeof n=="number"&&(deprecation("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),n={scaleMode:n,resolution:i,region:a});var l=n.region,u=__rest$1(n,["region"]);a=l||t.getLocalBounds(null,!0),a.width===0&&(a.width=1),a.height===0&&(a.height=1);var d=RenderTexture.create(__assign$1({width:a.width,height:a.height},u));return tempMatrix$3.tx=-a.x,tempMatrix$3.ty=-a.y,this.render(t,{renderTexture:d,clear:!1,transform:tempMatrix$3,skipUpdateTransform:!!t.parent}),d},e.prototype.destroy=function(t){for(var n in this.plugins)this.plugins[n].destroy(),this.plugins[n]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=RENDERER_TYPE.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=hex2string(t),hex2rgb(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(EventEmitter),GLBuffer=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),BufferSystem=function(){function r(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}return r.prototype.destroy=function(){this.renderer=null},r.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},r.prototype.bind=function(e){var t=this,n=t.gl,i=t.CONTEXT_UID,a=e._glBuffers[i]||this.createGLBuffer(e);n.bindBuffer(e.type,a.buffer)},r.prototype.bindBufferBase=function(e,t){var n=this,i=n.gl,a=n.CONTEXT_UID;if(this.boundBufferBases[t]!==e){var l=e._glBuffers[a]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,l.buffer)}},r.prototype.bindBufferRange=function(e,t,n){var i=this,a=i.gl,l=i.CONTEXT_UID;n=n||0;var u=e._glBuffers[l]||this.createGLBuffer(e);a.bindBufferRange(a.UNIFORM_BUFFER,t||0,u.buffer,n*256,256)},r.prototype.update=function(e){var t=this,n=t.gl,i=t.CONTEXT_UID,a=e._glBuffers[i];if(e._updateID!==a.updateID)if(a.updateID=e._updateID,n.bindBuffer(e.type,a.buffer),a.byteLength>=e.data.byteLength)n.bufferSubData(e.type,0,e.data);else{var l=e.static?n.STATIC_DRAW:n.DYNAMIC_DRAW;a.byteLength=e.data.byteLength,n.bufferData(e.type,e.data,l)}},r.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var n=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),n&&(t||i.deleteBuffer(n.buffer),delete e._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),n=0;n=MSAA_QUALITY.HIGH?this.multisample=MSAA_QUALITY.HIGH:n>=MSAA_QUALITY.MEDIUM?this.multisample=MSAA_QUALITY.MEDIUM:n>=MSAA_QUALITY.LOW?this.multisample=MSAA_QUALITY.LOW:this.multisample=MSAA_QUALITY.NONE},e.prototype.addSystem=function(t,n){var i=new t(this);if(this[n])throw new Error('Whoops! The name "'+n+'" is already in use');this[n]=i;for(var a in this.runners)this.runners[a].add(i);return this},e.prototype.render=function(t,n){var i,a,l,u;if(n&&(n instanceof RenderTexture?(deprecation("6.0.0","Renderer#render arguments changed, use options instead."),i=n,a=arguments[2],l=arguments[3],u=arguments[4]):(i=n.renderTexture,a=n.clear,l=n.transform,u=n.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=l,!this.context.isLost){if(i||(this._lastObjectRendered=t),!u){var d=t.enableTempParent();t.updateTransform(),t.disableTempParent(d)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(a!==void 0?a:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(t,n,i,a){n===void 0&&(n={});var l=r.prototype.generateTexture.call(this,t,n,i,a);return this.framebuffer.blit(),l},e.prototype.resize=function(t,n){r.prototype.resize.call(this,t,n),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(t){this.runners.destroy.emit();for(var n in this.runners)this.runners[n].destroy();r.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return deprecation("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,n){deprecation("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),extensions.add({name:t,type:ExtensionType.RendererPlugin,ref:n})},e.__plugins={},e}(AbstractRenderer);extensions.handleByMap(ExtensionType.RendererPlugin,Renderer.__plugins);function autoDetectRenderer(r){return Renderer.create(r)}var $defaultVertex=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,defaultVertex$1=$defaultVertex,BatchDrawCall=function(){function r(){this.texArray=null,this.blend=0,this.type=DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),BatchTextureArray=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this,n=t._bufferedTextures,i=t.MAX_TEXTURES,a=e._textureArrayPool,l=this.renderer.batch,u=this._tempBoundTextures,d=this.renderer.textureGC.count,f=++BaseTexture._globalBatch,m=0,s=a[0],o=0;l.copyBoundTextures(u,i);for(var c=0;c=i&&(l.boundArray(s,u,f,i),this.buildDrawCalls(s,o,c),o=c,s=a[++m],++f),v._batchEnabled=f,v.touched=d,s.elements[s.count++]=v)}s.count>0&&(l.boundArray(s,u,f,i),this.buildDrawCalls(s,o,this._bufferSize),++m,++f);for(var c=0;c0&&(t+=` -else `),nthis.maxX||this.minY>this.maxY},r.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},r.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?Rectangle.EMPTY:(e=e||new Rectangle(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},r.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},r.prototype.addPointMatrix=function(e,t){var n=e.a,i=e.b,a=e.c,l=e.d,u=e.tx,d=e.ty,f=n*t.x+a*t.y+u,m=i*t.x+l*t.y+d;this.minX=Math.min(this.minX,f),this.maxX=Math.max(this.maxX,f),this.minY=Math.min(this.minY,m),this.maxY=Math.max(this.maxY,m)},r.prototype.addQuad=function(e){var t=this.minX,n=this.minY,i=this.maxX,a=this.maxY,l=e[0],u=e[1];t=li?l:i,a=u>a?u:a,l=e[2],u=e[3],t=li?l:i,a=u>a?u:a,l=e[4],u=e[5],t=li?l:i,a=u>a?u:a,l=e[6],u=e[7],t=li?l:i,a=u>a?u:a,this.minX=t,this.minY=n,this.maxX=i,this.maxY=a},r.prototype.addFrame=function(e,t,n,i,a){this.addFrameMatrix(e.worldTransform,t,n,i,a)},r.prototype.addFrameMatrix=function(e,t,n,i,a){var l=e.a,u=e.b,d=e.c,f=e.d,m=e.tx,s=e.ty,o=this.minX,c=this.minY,v=this.maxX,y=this.maxY,_=l*t+d*n+m,b=u*t+f*n+s;o=_v?_:v,y=b>y?b:y,_=l*i+d*n+m,b=u*i+f*n+s,o=_v?_:v,y=b>y?b:y,_=l*t+d*a+m,b=u*t+f*a+s,o=_v?_:v,y=b>y?b:y,_=l*i+d*a+m,b=u*i+f*a+s,o=_v?_:v,y=b>y?b:y,this.minX=o,this.minY=c,this.maxX=v,this.maxY=y},r.prototype.addVertexData=function(e,t,n){for(var i=this.minX,a=this.minY,l=this.maxX,u=this.maxY,d=t;dl?f:l,u=m>u?m:u}this.minX=i,this.minY=a,this.maxX=l,this.maxY=u},r.prototype.addVertices=function(e,t,n,i){this.addVerticesMatrix(e.worldTransform,t,n,i)},r.prototype.addVerticesMatrix=function(e,t,n,i,a,l){a===void 0&&(a=0),l===void 0&&(l=a);for(var u=e.a,d=e.b,f=e.c,m=e.d,s=e.tx,o=e.ty,c=this.minX,v=this.minY,y=this.maxX,_=this.maxY,b=n;bi?e.maxX:i,this.maxY=e.maxY>a?e.maxY:a},r.prototype.addBoundsMask=function(e,t){var n=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,a=e.maxXf?a:f,this.maxY=l>m?l:m}},r.prototype.addBoundsMatrix=function(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)},r.prototype.addBoundsArea=function(e,t){var n=e.minX>t.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,a=e.maxXf?a:f,this.maxY=l>m?l:m}},r.prototype.pad=function(e,t){e===void 0&&(e=0),t===void 0&&(t=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)},r.prototype.addFramePad=function(e,t,n,i,a,l){e-=a,t-=l,n+=a,i+=l,this.minX=this.minXn?this.maxX:n,this.minY=this.minYi?this.maxY:i},r}();/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$y=function(r,e){return extendStatics$y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},extendStatics$y(r,e)};function __extends$y(r,e){extendStatics$y(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var DisplayObject=function(r){__extends$y(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Transform,t.alpha=1,t.visible=!0,t.renderable=!0,t.cullable=!1,t.cullArea=null,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new Bounds,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._maskRefCount=0,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}return e.mixin=function(t){for(var n=Object.keys(t),i=0;i1)for(var a=0;athis.children.length)throw new Error(t+"addChildAt: The index "+n+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(n,0,t),this._boundsID++,this.onChildrenChange(n),t.emit("added",this),this.emit("childAdded",t,this,n),t},e.prototype.swapChildren=function(t,n){if(t!==n){var i=this.getChildIndex(t),a=this.getChildIndex(n);this.children[i]=n,this.children[a]=t,this.onChildrenChange(i=this.children.length)throw new Error("The index "+n+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);removeItems(this.children,i,1),this.children.splice(n,0,t),this.onChildrenChange(n)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,n=[],i=0;i1)for(var a=0;a0&&l<=a){u=this.children.splice(i,l);for(var d=0;d1&&this.children.sort(sortChildren),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,n=this.children.length;t0&&n.height>0){var i,a;if(this.cullArea?(i=this.cullArea,a=this.worldTransform):this._render!==e.prototype._render&&(i=this.getBounds(!0)),i&&n.intersects(i,a))this._render(t);else if(this.cullArea)return;for(var l=0,u=this.children.length;l 0.0) { - c.rgb /= c.a; - - vec3 rgb = pow(c.rgb, vec3(1. / gamma)); - rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast); - rgb.r *= red; - rgb.g *= green; - rgb.b *= blue; - c.rgb = rgb * brightness; - - c.rgb *= c.a; - } - - gl_FragColor = c * alpha; -} -`;(function(r){__extends$x(e,r);function e(t){var n=r.call(this,vertex$u,fragment$v)||this;return n.gamma=1,n.saturation=1,n.contrast=1,n.brightness=1,n.red=1,n.green=1,n.blue=1,n.alpha=1,Object.assign(n,t),n}return e.prototype.apply=function(t,n,i,a){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,n,i,a)},e})(Filter);/*! - * @pixi/filter-kawase-blur - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-kawase-blur is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$w=function(r,e){return extendStatics$w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$w(r,e)};function __extends$w(r,e){extendStatics$w(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$t=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$u=` -varying vec2 vTextureCoord; -uniform sampler2D uSampler; - -uniform vec2 uOffset; - -void main(void) -{ - vec4 color = vec4(0.0); - - // Sample top left pixel - color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y)); - - // Sample top right pixel - color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y)); - - // Sample bottom right pixel - color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y)); - - // Sample bottom left pixel - color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y)); - - // Average - color *= 0.25; - - gl_FragColor = color; -}`,fragmentClamp=` -varying vec2 vTextureCoord; -uniform sampler2D uSampler; - -uniform vec2 uOffset; -uniform vec4 filterClamp; - -void main(void) -{ - vec4 color = vec4(0.0); - - // Sample top left pixel - color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw)); - - // Sample top right pixel - color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw)); - - // Sample bottom right pixel - color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw)); - - // Sample bottom left pixel - color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw)); - - // Average - color *= 0.25; - - gl_FragColor = color; -} -`,KawaseBlurFilter=function(r){__extends$w(e,r);function e(t,n,i){t===void 0&&(t=4),n===void 0&&(n=3),i===void 0&&(i=!1);var a=r.call(this,vertex$t,i?fragmentClamp:fragment$u)||this;return a._kernels=[],a._blur=4,a._quality=3,a.uniforms.uOffset=new Float32Array(2),a._pixelSize=new Point,a.pixelSize=1,a._clamp=i,Array.isArray(t)?a.kernels=t:(a._blur=t,a.quality=n),a}return e.prototype.apply=function(t,n,i,a){var l=this._pixelSize.x/n._frame.width,u=this._pixelSize.y/n._frame.height,d;if(this._quality===1||this._blur===0)d=this._kernels[0]+.5,this.uniforms.uOffset[0]=d*l,this.uniforms.uOffset[1]=d*u,t.applyFilter(this,n,i,a);else{for(var f=t.getFilterTexture(),m=n,s=f,o=void 0,c=this._quality-1,v=0;v0)for(var a=t,l=t/n,u=1;u0?(this._kernels=t,this._quality=t.length,this._blur=Math.max.apply(Math,t)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clamp",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._pixelSize},set:function(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof Point?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur=t,this._generateKernels()},enumerable:!1,configurable:!0}),e}(Filter);/*! - * @pixi/filter-advanced-bloom - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-advanced-bloom is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$v=function(r,e){return extendStatics$v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$v(r,e)};function __extends$v(r,e){extendStatics$v(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$s=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$t=` -uniform sampler2D uSampler; -varying vec2 vTextureCoord; - -uniform float threshold; - -void main() { - vec4 color = texture2D(uSampler, vTextureCoord); - - // A simple & fast algorithm for getting brightness. - // It's inaccuracy , but good enought for this feature. - float _max = max(max(color.r, color.g), color.b); - float _min = min(min(color.r, color.g), color.b); - float brightness = (_max + _min) * 0.5; - - if(brightness > threshold) { - gl_FragColor = color; - } else { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); - } -} -`,ExtractBrightnessFilter=function(r){__extends$v(e,r);function e(t){t===void 0&&(t=.5);var n=r.call(this,vertex$s,fragment$t)||this;return n.threshold=t,n}return Object.defineProperty(e.prototype,"threshold",{get:function(){return this.uniforms.threshold},set:function(t){this.uniforms.threshold=t},enumerable:!1,configurable:!0}),e}(Filter),fragment$1$1=`uniform sampler2D uSampler; -varying vec2 vTextureCoord; - -uniform sampler2D bloomTexture; -uniform float bloomScale; -uniform float brightness; - -void main() { - vec4 color = texture2D(uSampler, vTextureCoord); - color.rgb *= brightness; - vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0); - bloomColor.rgb *= bloomScale; - gl_FragColor = color + bloomColor; -} -`;(function(r){__extends$v(e,r);function e(t){var n=r.call(this,vertex$s,fragment$1$1)||this;n.bloomScale=1,n.brightness=1,n._resolution=settings.FILTER_RESOLUTION,typeof t=="number"&&(t={threshold:t});var i=Object.assign(e.defaults,t);n.bloomScale=i.bloomScale,n.brightness=i.brightness;var a=i.kernels,l=i.blur,u=i.quality,d=i.pixelSize,f=i.resolution;return n._extractFilter=new ExtractBrightnessFilter(i.threshold),n._extractFilter.resolution=f,n._blurFilter=a?new KawaseBlurFilter(a):new KawaseBlurFilter(l,u),n.pixelSize=d,n.resolution=f,n}return e.prototype.apply=function(t,n,i,a,l){var u=t.getFilterTexture();this._extractFilter.apply(t,n,u,1,l);var d=t.getFilterTexture();this._blurFilter.apply(t,u,d,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=d,t.applyFilter(this,n,i,a),t.returnFilterTexture(d),t.returnFilterTexture(u)},Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._extractFilter.threshold},set:function(t){this._extractFilter.threshold=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),e.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:settings.FILTER_RESOLUTION},e})(Filter);/*! - * @pixi/filter-ascii - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-ascii is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$u=function(r,e){return extendStatics$u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$u(r,e)};function __extends$u(r,e){extendStatics$u(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$r=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$s=`varying vec2 vTextureCoord; - -uniform vec4 filterArea; -uniform float pixelSize; -uniform sampler2D uSampler; - -vec2 mapCoord( vec2 coord ) -{ - coord *= filterArea.xy; - coord += filterArea.zw; - - return coord; -} - -vec2 unmapCoord( vec2 coord ) -{ - coord -= filterArea.zw; - coord /= filterArea.xy; - - return coord; -} - -vec2 pixelate(vec2 coord, vec2 size) -{ - return floor( coord / size ) * size; -} - -vec2 getMod(vec2 coord, vec2 size) -{ - return mod( coord , size) / size; -} - -float character(float n, vec2 p) -{ - p = floor(p*vec2(4.0, -4.0) + 2.5); - - if (clamp(p.x, 0.0, 4.0) == p.x) - { - if (clamp(p.y, 0.0, 4.0) == p.y) - { - if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0; - } - } - return 0.0; -} - -void main() -{ - vec2 coord = mapCoord(vTextureCoord); - - // get the rounded color.. - vec2 pixCoord = pixelate(coord, vec2(pixelSize)); - pixCoord = unmapCoord(pixCoord); - - vec4 color = texture2D(uSampler, pixCoord); - - // determine the character to use - float gray = (color.r + color.g + color.b) / 3.0; - - float n = 65536.0; // . - if (gray > 0.2) n = 65600.0; // : - if (gray > 0.3) n = 332772.0; // * - if (gray > 0.4) n = 15255086.0; // o - if (gray > 0.5) n = 23385164.0; // & - if (gray > 0.6) n = 15252014.0; // 8 - if (gray > 0.7) n = 13199452.0; // @ - if (gray > 0.8) n = 11512810.0; // # - - // get the mod.. - vec2 modd = getMod(coord, vec2(pixelSize)); - - gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0); - -} -`;(function(r){__extends$u(e,r);function e(t){t===void 0&&(t=8);var n=r.call(this,vertex$r,fragment$s)||this;return n.size=t,n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.pixelSize},set:function(t){this.uniforms.pixelSize=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-bevel - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-bevel is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$t=function(r,e){return extendStatics$t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$t(r,e)};function __extends$t(r,e){extendStatics$t(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$q=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$r=`precision mediump float; - -varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform vec4 filterArea; - -uniform float transformX; -uniform float transformY; -uniform vec3 lightColor; -uniform float lightAlpha; -uniform vec3 shadowColor; -uniform float shadowAlpha; - -void main(void) { - vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY); - vec4 color = texture2D(uSampler, vTextureCoord); - float light = texture2D(uSampler, vTextureCoord - transform).a; - float shadow = texture2D(uSampler, vTextureCoord + transform).a; - - color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0)); - color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0)); - gl_FragColor = vec4(color.rgb * color.a, color.a); -} -`;(function(r){__extends$t(e,r);function e(t){var n=r.call(this,vertex$q,fragment$r)||this;return n._thickness=2,n._angle=0,n.uniforms.lightColor=new Float32Array(3),n.uniforms.shadowColor=new Float32Array(3),Object.assign(n,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),n.padding=1,n}return e.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._angle/DEG_TO_RAD},set:function(t){this._angle=t*DEG_TO_RAD,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightColor",{get:function(){return rgb2hex(this.uniforms.lightColor)},set:function(t){hex2rgb(t,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightAlpha",{get:function(){return this.uniforms.lightAlpha},set:function(t){this.uniforms.lightAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return rgb2hex(this.uniforms.shadowColor)},set:function(t){hex2rgb(t,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowAlpha",{get:function(){return this.uniforms.shadowAlpha},set:function(t){this.uniforms.shadowAlpha=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-alpha - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/filter-alpha is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$s=function(r,e){return extendStatics$s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},extendStatics$s(r,e)};function __extends$s(r,e){extendStatics$s(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var fragment$q=`varying vec2 vTextureCoord; - -uniform sampler2D uSampler; -uniform float uAlpha; - -void main(void) -{ - gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; -} -`,AlphaFilter=function(r){__extends$s(e,r);function e(t){t===void 0&&(t=1);var n=r.call(this,defaultVertex$1,fragment$q,{uAlpha:1})||this;return n.alpha=t,n}return Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Filter);/*! - * @pixi/filter-blur - v6.5.10 - * Compiled Thu, 06 Jul 2023 15:25:11 UTC - * - * @pixi/filter-blur is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$r=function(r,e){return extendStatics$r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},extendStatics$r(r,e)};function __extends$r(r,e){extendStatics$r(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertTemplate=` - attribute vec2 aVertexPosition; - - uniform mat3 projectionMatrix; - - uniform float strength; - - varying vec2 vBlurTexCoords[%size%]; - - uniform vec4 inputSize; - uniform vec4 outputFrame; - - vec4 filterVertexPosition( void ) - { - vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; - - return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); - } - - vec2 filterTextureCoord( void ) - { - return aVertexPosition * (outputFrame.zw * inputSize.zw); - } - - void main(void) - { - gl_Position = filterVertexPosition(); - - vec2 textureCoord = filterTextureCoord(); - %blur% - }`;function generateBlurVertSource(r,e){var t=Math.ceil(r/2),n=vertTemplate,i="",a;e?a="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":a="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var l=0;l=t&&(l=r-u-1),d=d.replace("%value%",e[l].toString()),i+=d,i+=` -`}return n=n.replace("%blur%",i),n=n.replace("%size%",r.toString()),n}var BlurFilterPass=function(r){__extends$r(e,r);function e(t,n,i,a,l){n===void 0&&(n=8),i===void 0&&(i=4),a===void 0&&(a=settings.FILTER_RESOLUTION),l===void 0&&(l=5);var u=this,d=generateBlurVertSource(l,t),f=generateBlurFragSource(l);return u=r.call(this,d,f)||this,u.horizontal=t,u.resolution=a,u._quality=0,u.quality=i,u.blur=n,u}return e.prototype.apply=function(t,n,i,a){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/n.width):this.uniforms.strength=1/i.height*(i.height/n.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/n.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/n.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,n,i,a);else{var l=t.getFilterTexture(),u=t.renderer,d=n,f=l;this.state.blend=!1,t.applyFilter(this,d,f,CLEAR_MODES.CLEAR);for(var m=1;m 0.0) { - coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75); - } else { - coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent); - } - } - coord += center * dimensions.xy; - coord /= filterArea.xy; - vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw); - vec4 color = texture2D(uSampler, clampedCoord); - if (coord != clampedCoord) { - color *= max(0.0, 1.0 - length(coord - clampedCoord)); - } - - gl_FragColor = color; -} -`;(function(r){__extends$p(e,r);function e(t){var n=r.call(this,vertex$p,fragment$p)||this;return n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,a){var l=n.filterFrame,u=l.width,d=l.height;this.uniforms.dimensions[0]=u,this.uniforms.dimensions[1]=d,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),e.defaults={center:[.5,.5],radius:100,strength:1},e})(Filter);/*! - * @pixi/filter-color-map - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-color-map is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$o=function(r,e){return extendStatics$o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$o(r,e)};function __extends$o(r,e){extendStatics$o(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$o=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$o=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform sampler2D colorMap; -uniform float _mix; -uniform float _size; -uniform float _sliceSize; -uniform float _slicePixelSize; -uniform float _sliceInnerSize; -void main() { - vec4 color = texture2D(uSampler, vTextureCoord.xy); - - vec4 adjusted; - if (color.a > 0.0) { - color.rgb /= color.a; - float innerWidth = _size - 1.0; - float zSlice0 = min(floor(color.b * innerWidth), innerWidth); - float zSlice1 = min(zSlice0 + 1.0, innerWidth); - float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize; - float s0 = xOffset + (zSlice0 * _sliceSize); - float s1 = xOffset + (zSlice1 * _sliceSize); - float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize); - vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset)); - vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset)); - float zOffset = fract(color.b * innerWidth); - adjusted = mix(slice0Color, slice1Color, zOffset); - - color.rgb *= color.a; - } - gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a); - -}`;(function(r){__extends$o(e,r);function e(t,n,i){n===void 0&&(n=!1),i===void 0&&(i=1);var a=r.call(this,vertex$o,fragment$o)||this;return a.mix=1,a._size=0,a._sliceSize=0,a._slicePixelSize=0,a._sliceInnerSize=0,a._nearest=!1,a._scaleMode=null,a._colorMap=null,a._scaleMode=null,a.nearest=n,a.mix=i,a.colorMap=t,a}return e.prototype.apply=function(t,n,i,a){this.uniforms._mix=this.mix,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"colorSize",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorMap",{get:function(){return this._colorMap},set:function(t){var n;t&&(t instanceof Texture||(t=Texture.from(t)),!((n=t)===null||n===void 0)&&n.baseTexture&&(t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=MIPMAP_MODES.OFF,this._size=t.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=t),this._colorMap=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nearest",{get:function(){return this._nearest},set:function(t){this._nearest=t,this._scaleMode=t?SCALE_MODES.NEAREST:SCALE_MODES.LINEAR;var n=this._colorMap;n&&n.baseTexture&&(n.baseTexture._glTextures={},n.baseTexture.scaleMode=this._scaleMode,n.baseTexture.mipmap=MIPMAP_MODES.OFF,n._updateID++,n.baseTexture.emit("update",n.baseTexture))},enumerable:!1,configurable:!0}),e.prototype.updateColorMap=function(){var t=this._colorMap;t&&t.baseTexture&&(t._updateID++,t.baseTexture.emit("update",t.baseTexture),this.colorMap=t)},e.prototype.destroy=function(t){t===void 0&&(t=!1),this._colorMap&&this._colorMap.destroy(t),r.prototype.destroy.call(this)},e})(Filter);/*! - * @pixi/filter-color-overlay - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-color-overlay is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$n=function(r,e){return extendStatics$n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$n(r,e)};function __extends$n(r,e){extendStatics$n(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$n=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$n=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform vec3 color; -uniform float alpha; - -void main(void) { - vec4 currentColor = texture2D(uSampler, vTextureCoord); - gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a); -} -`;(function(r){__extends$n(e,r);function e(t,n){t===void 0&&(t=0),n===void 0&&(n=1);var i=r.call(this,vertex$n,fragment$n)||this;return i._color=0,i._alpha=1,i.uniforms.color=new Float32Array(3),i.color=t,i.alpha=n,i}return Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var n=this.uniforms.color;typeof t=="number"?(hex2rgb(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._color=rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this.uniforms.alpha=t,this._alpha=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-color-replace - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-color-replace is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$m=function(r,e){return extendStatics$m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$m(r,e)};function __extends$m(r,e){extendStatics$m(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$m=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$m=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform vec3 originalColor; -uniform vec3 newColor; -uniform float epsilon; -void main(void) { - vec4 currentColor = texture2D(uSampler, vTextureCoord); - vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001)); - float colorDistance = length(colorDiff); - float doReplace = step(colorDistance, epsilon); - gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a); -} -`;(function(r){__extends$m(e,r);function e(t,n,i){t===void 0&&(t=16711680),n===void 0&&(n=0),i===void 0&&(i=.4);var a=r.call(this,vertex$m,fragment$m)||this;return a._originalColor=16711680,a._newColor=0,a.uniforms.originalColor=new Float32Array(3),a.uniforms.newColor=new Float32Array(3),a.originalColor=t,a.newColor=n,a.epsilon=i,a}return Object.defineProperty(e.prototype,"originalColor",{get:function(){return this._originalColor},set:function(t){var n=this.uniforms.originalColor;typeof t=="number"?(hex2rgb(t,n),this._originalColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._originalColor=rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"newColor",{get:function(){return this._newColor},set:function(t){var n=this.uniforms.newColor;typeof t=="number"?(hex2rgb(t,n),this._newColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._newColor=rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"epsilon",{get:function(){return this.uniforms.epsilon},set:function(t){this.uniforms.epsilon=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-convolution - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-convolution is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$l=function(r,e){return extendStatics$l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$l(r,e)};function __extends$l(r,e){extendStatics$l(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$l=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$l=`precision mediump float; - -varying mediump vec2 vTextureCoord; - -uniform sampler2D uSampler; -uniform vec2 texelSize; -uniform float matrix[9]; - -void main(void) -{ - vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left - vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center - vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right - - vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left - vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center - vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right - - vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left - vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center - vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right - - gl_FragColor = - c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] + - c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] + - c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8]; - - gl_FragColor.a = c22.a; -} -`;(function(r){__extends$l(e,r);function e(t,n,i){n===void 0&&(n=200),i===void 0&&(i=200);var a=r.call(this,vertex$l,fragment$l)||this;return a.uniforms.texelSize=new Float32Array(2),a.uniforms.matrix=new Float32Array(9),t!==void 0&&(a.matrix=t),a.width=n,a.height=i,a}return Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.matrix},set:function(t){var n=this;t.forEach(function(i,a){n.uniforms.matrix[a]=i})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(t){this.uniforms.texelSize[0]=1/t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(t){this.uniforms.texelSize[1]=1/t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-cross-hatch - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-cross-hatch is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$k=function(r,e){return extendStatics$k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$k(r,e)};function __extends$k(r,e){extendStatics$k(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$k=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$k=`precision mediump float; - -varying vec2 vTextureCoord; - -uniform sampler2D uSampler; - -void main(void) -{ - float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb); - - gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); - - if (lum < 1.00) - { - if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) - { - gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - } - } - - if (lum < 0.75) - { - if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) - { - gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - } - } - - if (lum < 0.50) - { - if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) - { - gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - } - } - - if (lum < 0.3) - { - if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) - { - gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - } - } -} -`;(function(r){__extends$k(e,r);function e(){return r.call(this,vertex$k,fragment$k)||this}return e})(Filter);/*! - * @pixi/filter-crt - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-crt is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$j=function(r,e){return extendStatics$j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$j(r,e)};function __extends$j(r,e){extendStatics$j(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$j=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$j=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; - -uniform vec4 filterArea; -uniform vec2 dimensions; - -const float SQRT_2 = 1.414213; - -const float light = 1.0; - -uniform float curvature; -uniform float lineWidth; -uniform float lineContrast; -uniform bool verticalLine; -uniform float noise; -uniform float noiseSize; - -uniform float vignetting; -uniform float vignettingAlpha; -uniform float vignettingBlur; - -uniform float seed; -uniform float time; - -float rand(vec2 co) { - return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); -} - -void main(void) -{ - vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; - vec2 dir = vec2(vTextureCoord.xy * filterArea.xy / dimensions - vec2(0.5, 0.5)); - - gl_FragColor = texture2D(uSampler, vTextureCoord); - vec3 rgb = gl_FragColor.rgb; - - if (noise > 0.0 && noiseSize > 0.0) - { - pixelCoord.x = floor(pixelCoord.x / noiseSize); - pixelCoord.y = floor(pixelCoord.y / noiseSize); - float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; - rgb += _noise * noise; - } - - if (lineWidth > 0.0) - { - float _c = curvature > 0. ? curvature : 1.; - float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.; - vec2 uv = dir * k; - - float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c; - float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast; - rgb *= j; - float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.); - rgb *= 0.99 + ceil(segment) * 0.015; - } - - if (vignetting > 0.0) - { - float outter = SQRT_2 - vignetting * SQRT_2; - float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); - rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); - } - - gl_FragColor.rgb = rgb; -} -`;(function(r){__extends$j(e,r);function e(t){var n=r.call(this,vertex$j,fragment$j)||this;return n.time=0,n.seed=0,n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,a){var l=n.filterFrame,u=l.width,d=l.height;this.uniforms.dimensions[0]=u,this.uniforms.dimensions[1]=d,this.uniforms.seed=this.seed,this.uniforms.time=this.time,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"curvature",{get:function(){return this.uniforms.curvature},set:function(t){this.uniforms.curvature=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.uniforms.lineWidth},set:function(t){this.uniforms.lineWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineContrast",{get:function(){return this.uniforms.lineContrast},set:function(t){this.uniforms.lineContrast=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalLine",{get:function(){return this.uniforms.verticalLine},set:function(t){this.uniforms.verticalLine=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e})(Filter);/*! - * @pixi/filter-dot - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-dot is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$i=function(r,e){return extendStatics$i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$i(r,e)};function __extends$i(r,e){extendStatics$i(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$i=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$i=`precision mediump float; - -varying vec2 vTextureCoord; -varying vec4 vColor; - -uniform vec4 filterArea; -uniform sampler2D uSampler; - -uniform float angle; -uniform float scale; - -float pattern() -{ - float s = sin(angle), c = cos(angle); - vec2 tex = vTextureCoord * filterArea.xy; - vec2 point = vec2( - c * tex.x - s * tex.y, - s * tex.x + c * tex.y - ) * scale; - return (sin(point.x) * sin(point.y)) * 4.0; -} - -void main() -{ - vec4 color = texture2D(uSampler, vTextureCoord); - float average = (color.r + color.g + color.b) / 3.0; - gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a); -} -`;(function(r){__extends$i(e,r);function e(t,n){t===void 0&&(t=1),n===void 0&&(n=5);var i=r.call(this,vertex$i,fragment$i)||this;return i.scale=t,i.angle=n,i}return Object.defineProperty(e.prototype,"scale",{get:function(){return this.uniforms.scale},set:function(t){this.uniforms.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-drop-shadow - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-drop-shadow is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$h=function(r,e){return extendStatics$h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$h(r,e)};function __extends$h(r,e){extendStatics$h(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var __assign=function(){return __assign=Object.assign||function(e){for(var t=arguments,n,i=1,a=arguments.length;i 1.0 || coord.y > 1.0) { - return; - } - - float cx = coord.x - 0.5; - float cy = (coord.y - 0.5) * aspect; - float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5; - - // displacementMap: repeat - // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny); - - // displacementMap: mirror - ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny); - - vec4 dc = texture2D(displacementMap, vec2(0.5, ny)); - - float displacement = (dc.r - dc.g) * (offset / filterArea.x); - - coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect); - - if (fillMode == CLAMP) { - coord = clamp(coord, filterClamp.xy, filterClamp.zw); - } else { - if( coord.x > filterClamp.z ) { - if (fillMode == TRANSPARENT) { - discard; - } else if (fillMode == LOOP) { - coord.x -= filterClamp.z; - } else if (fillMode == MIRROR) { - coord.x = filterClamp.z * 2.0 - coord.x; - } - } else if( coord.x < filterClamp.x ) { - if (fillMode == TRANSPARENT) { - discard; - } else if (fillMode == LOOP) { - coord.x += filterClamp.z; - } else if (fillMode == MIRROR) { - coord.x *= -filterClamp.z; - } - } - - if( coord.y > filterClamp.w ) { - if (fillMode == TRANSPARENT) { - discard; - } else if (fillMode == LOOP) { - coord.y -= filterClamp.w; - } else if (fillMode == MIRROR) { - coord.y = filterClamp.w * 2.0 - coord.y; - } - } else if( coord.y < filterClamp.y ) { - if (fillMode == TRANSPARENT) { - discard; - } else if (fillMode == LOOP) { - coord.y += filterClamp.w; - } else if (fillMode == MIRROR) { - coord.y *= -filterClamp.w; - } - } - } - - gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r; - gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g; - gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b; - gl_FragColor.a = texture2D(uSampler, coord).a; -} -`;(function(r){__extends$f(e,r);function e(t){var n=r.call(this,vertex$f,fragment$f)||this;return n.offset=100,n.fillMode=e.TRANSPARENT,n.average=!1,n.seed=0,n.minSize=8,n.sampleSize=512,n._slices=0,n._offsets=new Float32Array(1),n._sizes=new Float32Array(1),n._direction=-1,n.uniforms.dimensions=new Float32Array(2),n._canvas=document.createElement("canvas"),n._canvas.width=4,n._canvas.height=n.sampleSize,n.texture=Texture.from(n._canvas,{scaleMode:SCALE_MODES.NEAREST}),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,a){var l=n.filterFrame,u=l.width,d=l.height;this.uniforms.dimensions[0]=u,this.uniforms.dimensions[1]=d,this.uniforms.aspect=d/u,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,t.applyFilter(this,n,i,a)},e.prototype._randomizeSizes=function(){var t=this._sizes,n=this._slices-1,i=this.sampleSize,a=Math.min(this.minSize/i,.9/this._slices);if(this.average){for(var l=this._slices,u=1,d=0;d0;i--){var a=Math.random()*i>>0,l=t[i];t[i]=t[a],t[a]=l}},e.prototype._randomizeOffsets=function(){for(var t=0;t0?a:0,m=a<0?-a:0;i.fillStyle="rgba("+f+", "+m+", 0, 1)",i.fillRect(0,l>>0,t,d+1>>0),l+=d}n.baseTexture.update(),this.uniforms.displacementMap=n},Object.defineProperty(e.prototype,"sizes",{get:function(){return this._sizes},set:function(t){for(var n=Math.min(this._slices,t.length),i=0;i>0)+1},Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(t){this.uniforms.uOffset=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-multi-color-replace - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-multi-color-replace is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$b=function(r,e){return extendStatics$b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$b(r,e)};function __extends$b(r,e){extendStatics$b(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$b=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$b=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; - -uniform float epsilon; - -const int MAX_COLORS = %maxColors%; - -uniform vec3 originalColors[MAX_COLORS]; -uniform vec3 targetColors[MAX_COLORS]; - -void main(void) -{ - gl_FragColor = texture2D(uSampler, vTextureCoord); - - float alpha = gl_FragColor.a; - if (alpha < 0.0001) - { - return; - } - - vec3 color = gl_FragColor.rgb / alpha; - - for(int i = 0; i < MAX_COLORS; i++) - { - vec3 origColor = originalColors[i]; - if (origColor.r < 0.0) - { - break; - } - vec3 colorDiff = origColor - color; - if (length(colorDiff) < epsilon) - { - vec3 targetColor = targetColors[i]; - gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha); - return; - } - } -} -`;(function(r){__extends$b(e,r);function e(t,n,i){n===void 0&&(n=.05),i===void 0&&(i=t.length);var a=r.call(this,vertex$b,fragment$b.replace(/%maxColors%/g,i.toFixed(0)))||this;return a._replacements=[],a._maxColors=0,a.epsilon=n,a._maxColors=i,a.uniforms.originalColors=new Float32Array(i*3),a.uniforms.targetColors=new Float32Array(i*3),a.replacements=t,a}return Object.defineProperty(e.prototype,"replacements",{get:function(){return this._replacements},set:function(t){var n=this.uniforms.originalColors,i=this.uniforms.targetColors,a=t.length;if(a>this._maxColors)throw new Error("Length of replacements ("+a+") exceeds the maximum colors length ("+this._maxColors+")");n[a*3]=-1;for(var l=0;l 0.5) then: 1 - 2 * (1 - dst) * (1 - src) - return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), - (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), - (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z))); -} - - -void main() -{ - gl_FragColor = texture2D(uSampler, vTextureCoord); - vec3 color = gl_FragColor.rgb; - - if (sepia > 0.0) - { - float gray = (color.x + color.y + color.z) / 3.0; - vec3 grayscale = vec3(gray); - - color = Overlay(SEPIA_RGB, grayscale); - - color = grayscale + sepia * (color - grayscale); - } - - vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy; - - if (vignetting > 0.0) - { - float outter = SQRT_2 - vignetting * SQRT_2; - vec2 dir = vec2(vec2(0.5, 0.5) - coord); - dir.y *= dimensions.y / dimensions.x; - float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); - color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); - } - - if (scratchDensity > seed && scratch != 0.0) - { - float phase = seed * 256.0; - float s = mod(floor(phase), 2.0); - float dist = 1.0 / scratchDensity; - float d = distance(coord, vec2(seed * dist, abs(s - seed * dist))); - if (d < seed * 0.6 + 0.4) - { - highp float period = scratchDensity * 10.0; - - float xx = coord.x * period + phase; - float aa = abs(mod(xx, 0.5) * 4.0); - float bb = mod(floor(xx / 0.5), 2.0); - float yy = (1.0 - bb) * aa + bb * (2.0 - aa); - - float kk = 2.0 * period; - float dw = scratchWidth / dimensions.x * (0.75 + seed); - float dh = dw * kk; - - float tine = (yy - (2.0 - dh)); - - if (tine > 0.0) { - float _sign = sign(scratch); - - tine = s * tine / period + scratch + 0.1; - tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5); - - color.rgb *= tine; - } - } - } - - if (noise > 0.0 && noiseSize > 0.0) - { - vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; - pixelCoord.x = floor(pixelCoord.x / noiseSize); - pixelCoord.y = floor(pixelCoord.y / noiseSize); - // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0); - // float _noise = snoise(d) * 0.5; - float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; - color += _noise * noise; - } - - gl_FragColor.rgb = color; -} -`;(function(r){__extends$a(e,r);function e(t,n){n===void 0&&(n=0);var i=r.call(this,vertex$a,fragment$a)||this;return i.seed=0,i.uniforms.dimensions=new Float32Array(2),typeof t=="number"?(i.seed=t,t=void 0):i.seed=n,Object.assign(i,e.defaults,t),i}return e.prototype.apply=function(t,n,i,a){var l,u;this.uniforms.dimensions[0]=(l=n.filterFrame)===null||l===void 0?void 0:l.width,this.uniforms.dimensions[1]=(u=n.filterFrame)===null||u===void 0?void 0:u.height,this.uniforms.seed=this.seed,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"sepia",{get:function(){return this.uniforms.sepia},set:function(t){this.uniforms.sepia=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratch",{get:function(){return this.uniforms.scratch},set:function(t){this.uniforms.scratch=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchDensity",{get:function(){return this.uniforms.scratchDensity},set:function(t){this.uniforms.scratchDensity=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchWidth",{get:function(){return this.uniforms.scratchWidth},set:function(t){this.uniforms.scratchWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e})(Filter);/*! - * @pixi/filter-outline - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-outline is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$9=function(r,e){return extendStatics$9=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$9(r,e)};function __extends$9(r,e){extendStatics$9(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$9=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$9=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; - -uniform vec2 thickness; -uniform vec4 outlineColor; -uniform vec4 filterClamp; - -const float DOUBLE_PI = 3.14159265358979323846264 * 2.; - -void main(void) { - vec4 ownColor = texture2D(uSampler, vTextureCoord); - vec4 curColor; - float maxAlpha = 0.; - vec2 displaced; - for (float angle = 0.; angle <= DOUBLE_PI; angle += \${angleStep}) { - displaced.x = vTextureCoord.x + thickness.x * cos(angle); - displaced.y = vTextureCoord.y + thickness.y * sin(angle); - curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw)); - maxAlpha = max(maxAlpha, curColor.a); - } - float resultAlpha = max(maxAlpha, ownColor.a); - gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha); -} -`;(function(r){__extends$9(e,r);function e(t,n,i){t===void 0&&(t=1),n===void 0&&(n=0),i===void 0&&(i=.1);var a=r.call(this,vertex$9,fragment$9.replace(/\$\{angleStep\}/,e.getAngleStep(i)))||this;return a._thickness=1,a.uniforms.thickness=new Float32Array([0,0]),a.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(a,{thickness:t,color:n,quality:i}),a}return e.getAngleStep=function(t){var n=Math.max(t*e.MAX_SAMPLES,e.MIN_SAMPLES);return(Math.PI*2/n).toFixed(7)},e.prototype.apply=function(t,n,i,a){this.uniforms.thickness[0]=this._thickness/n._frame.width,this.uniforms.thickness[1]=this._thickness/n._frame.height,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"color",{get:function(){return rgb2hex(this.uniforms.outlineColor)},set:function(t){hex2rgb(t,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this.padding=t},enumerable:!1,configurable:!0}),e.MIN_SAMPLES=1,e.MAX_SAMPLES=100,e})(Filter);/*! - * @pixi/filter-pixelate - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-pixelate is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$8=function(r,e){return extendStatics$8=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$8(r,e)};function __extends$8(r,e){extendStatics$8(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$8=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$8=`precision mediump float; - -varying vec2 vTextureCoord; - -uniform vec2 size; -uniform sampler2D uSampler; - -uniform vec4 filterArea; - -vec2 mapCoord( vec2 coord ) -{ - coord *= filterArea.xy; - coord += filterArea.zw; - - return coord; -} - -vec2 unmapCoord( vec2 coord ) -{ - coord -= filterArea.zw; - coord /= filterArea.xy; - - return coord; -} - -vec2 pixelate(vec2 coord, vec2 size) -{ - return floor( coord / size ) * size; -} - -void main(void) -{ - vec2 coord = mapCoord(vTextureCoord); - - coord = pixelate(coord, size); - - coord = unmapCoord(coord); - - gl_FragColor = texture2D(uSampler, coord); -} -`;(function(r){__extends$8(e,r);function e(t){t===void 0&&(t=10);var n=r.call(this,vertex$8,fragment$8)||this;return n.size=t,n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.size},set:function(t){typeof t=="number"&&(t=[t,t]),this.uniforms.size=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-radial-blur - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-radial-blur is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$7=function(r,e){return extendStatics$7=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$7(r,e)};function __extends$7(r,e){extendStatics$7(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$7=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$7=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform vec4 filterArea; - -uniform float uRadian; -uniform vec2 uCenter; -uniform float uRadius; -uniform int uKernelSize; - -const int MAX_KERNEL_SIZE = 2048; - -void main(void) -{ - vec4 color = texture2D(uSampler, vTextureCoord); - - if (uKernelSize == 0) - { - gl_FragColor = color; - return; - } - - float aspect = filterArea.y / filterArea.x; - vec2 center = uCenter.xy / filterArea.xy; - float gradient = uRadius / filterArea.x * 0.3; - float radius = uRadius / filterArea.x - gradient * 0.5; - int k = uKernelSize - 1; - - vec2 coord = vTextureCoord; - vec2 dir = vec2(center - coord); - float dist = length(vec2(dir.x, dir.y * aspect)); - - float radianStep = uRadian; - if (radius >= 0.0 && dist > radius) { - float delta = dist - radius; - float gap = gradient; - float scale = 1.0 - abs(delta / gap); - if (scale <= 0.0) { - gl_FragColor = color; - return; - } - radianStep *= scale; - } - radianStep /= float(k); - - float s = sin(radianStep); - float c = cos(radianStep); - mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c)); - - for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) { - if (i == k) { - break; - } - - coord -= center; - coord.y *= aspect; - coord = rotationMatrix * coord; - coord.y /= aspect; - coord += center; - - vec4 sample = texture2D(uSampler, coord); - - // switch to pre-multiplied alpha to correctly blur transparent images - // sample.rgb *= sample.a; - - color += sample; - } - - gl_FragColor = color / float(uKernelSize); -} -`;(function(r){__extends$7(e,r);function e(t,n,i,a){t===void 0&&(t=0),n===void 0&&(n=[0,0]),i===void 0&&(i=5),a===void 0&&(a=-1);var l=r.call(this,vertex$7,fragment$7)||this;return l._angle=0,l.angle=t,l.center=n,l.kernelSize=i,l.radius=a,l}return e.prototype.apply=function(t,n,i,a){this.uniforms.uKernelSize=this._angle!==0?this.kernelSize:0,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.uniforms.uRadian=t*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-reflection - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-reflection is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$6=function(r,e){return extendStatics$6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$6(r,e)};function __extends$6(r,e){extendStatics$6(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$6=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$6=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; - -uniform vec4 filterArea; -uniform vec4 filterClamp; -uniform vec2 dimensions; - -uniform bool mirror; -uniform float boundary; -uniform vec2 amplitude; -uniform vec2 waveLength; -uniform vec2 alpha; -uniform float time; - -float rand(vec2 co) { - return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); -} - -void main(void) -{ - vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; - vec2 coord = pixelCoord / dimensions; - - if (coord.y < boundary) { - gl_FragColor = texture2D(uSampler, vTextureCoord); - return; - } - - float k = (coord.y - boundary) / (1. - boundary + 0.0001); - float areaY = boundary * dimensions.y / filterArea.y; - float v = areaY + areaY - vTextureCoord.y; - float y = mirror ? v : vTextureCoord.y; - - float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x; - float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y; - float _alpha = (alpha.y - alpha.x) * k + alpha.x; - - float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude; - x = clamp(x, filterClamp.x, filterClamp.z); - - vec4 color = texture2D(uSampler, vec2(x, y)); - - gl_FragColor = color * _alpha; -} -`;(function(r){__extends$6(e,r);function e(t){var n=r.call(this,vertex$6,fragment$6)||this;return n.time=0,n.uniforms.amplitude=new Float32Array(2),n.uniforms.waveLength=new Float32Array(2),n.uniforms.alpha=new Float32Array(2),n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,a){var l,u;this.uniforms.dimensions[0]=(l=n.filterFrame)===null||l===void 0?void 0:l.width,this.uniforms.dimensions[1]=(u=n.filterFrame)===null||u===void 0?void 0:u.height,this.uniforms.time=this.time,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"mirror",{get:function(){return this.uniforms.mirror},set:function(t){this.uniforms.mirror=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this.uniforms.boundary},set:function(t){this.uniforms.boundary=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude[0]=t[0],this.uniforms.amplitude[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"waveLength",{get:function(){return this.uniforms.waveLength},set:function(t){this.uniforms.waveLength[0]=t[0],this.uniforms.waveLength[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.alpha},set:function(t){this.uniforms.alpha[0]=t[0],this.uniforms.alpha[1]=t[1]},enumerable:!1,configurable:!0}),e.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e})(Filter);/*! - * @pixi/filter-rgb-split - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-rgb-split is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$5=function(r,e){return extendStatics$5=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$5(r,e)};function __extends$5(r,e){extendStatics$5(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$5=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$5=`precision mediump float; - -varying vec2 vTextureCoord; - -uniform sampler2D uSampler; -uniform vec4 filterArea; -uniform vec2 red; -uniform vec2 green; -uniform vec2 blue; - -void main(void) -{ - gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r; - gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g; - gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b; - gl_FragColor.a = texture2D(uSampler, vTextureCoord).a; -} -`;(function(r){__extends$5(e,r);function e(t,n,i){t===void 0&&(t=[-10,0]),n===void 0&&(n=[0,10]),i===void 0&&(i=[0,0]);var a=r.call(this,vertex$5,fragment$5)||this;return a.red=t,a.green=n,a.blue=i,a}return Object.defineProperty(e.prototype,"red",{get:function(){return this.uniforms.red},set:function(t){this.uniforms.red=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.uniforms.green},set:function(t){this.uniforms.green=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.uniforms.blue},set:function(t){this.uniforms.blue=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-shockwave - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-shockwave is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$4=function(r,e){return extendStatics$4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$4(r,e)};function __extends$4(r,e){extendStatics$4(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$4=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$4=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform vec4 filterArea; -uniform vec4 filterClamp; - -uniform vec2 center; - -uniform float amplitude; -uniform float wavelength; -// uniform float power; -uniform float brightness; -uniform float speed; -uniform float radius; - -uniform float time; - -const float PI = 3.14159; - -void main() -{ - float halfWavelength = wavelength * 0.5 / filterArea.x; - float maxRadius = radius / filterArea.x; - float currentRadius = time * speed / filterArea.x; - - float fade = 1.0; - - if (maxRadius > 0.0) { - if (currentRadius > maxRadius) { - gl_FragColor = texture2D(uSampler, vTextureCoord); - return; - } - fade = 1.0 - pow(currentRadius / maxRadius, 2.0); - } - - vec2 dir = vec2(vTextureCoord - center / filterArea.xy); - dir.y *= filterArea.y / filterArea.x; - float dist = length(dir); - - if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) { - gl_FragColor = texture2D(uSampler, vTextureCoord); - return; - } - - vec2 diffUV = normalize(dir); - - float diff = (dist - currentRadius) / halfWavelength; - - float p = 1.0 - pow(abs(diff), 2.0); - - // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade ); - float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade ); - - vec2 offset = diffUV * powDiff / filterArea.xy; - - // Do clamp : - vec2 coord = vTextureCoord + offset; - vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw); - vec4 color = texture2D(uSampler, clampedCoord); - if (coord != clampedCoord) { - color *= max(0.0, 1.0 - length(coord - clampedCoord)); - } - - // No clamp : - // gl_FragColor = texture2D(uSampler, vTextureCoord + offset); - - color.rgb *= 1.0 + (brightness - 1.0) * p * fade; - - gl_FragColor = color; -} -`;(function(r){__extends$4(e,r);function e(t,n,i){t===void 0&&(t=[0,0]),i===void 0&&(i=0);var a=r.call(this,vertex$4,fragment$4)||this;return a.center=t,Object.assign(a,e.defaults,n),a.time=i,a}return e.prototype.apply=function(t,n,i,a){this.uniforms.time=this.time,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wavelength",{get:function(){return this.uniforms.wavelength},set:function(t){this.uniforms.wavelength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"brightness",{get:function(){return this.uniforms.brightness},set:function(t){this.uniforms.brightness=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this.uniforms.speed},set:function(t){this.uniforms.speed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),e.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},e})(Filter);/*! - * @pixi/filter-simple-lightmap - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-simple-lightmap is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$3=function(r,e){return extendStatics$3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$3(r,e)};function __extends$3(r,e){extendStatics$3(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$3=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$3=`varying vec2 vTextureCoord; -uniform sampler2D uSampler; -uniform sampler2D uLightmap; -uniform vec4 filterArea; -uniform vec2 dimensions; -uniform vec4 ambientColor; -void main() { - vec4 diffuseColor = texture2D(uSampler, vTextureCoord); - vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions; - vec4 light = texture2D(uLightmap, lightCoord); - vec3 ambient = ambientColor.rgb * ambientColor.a; - vec3 intensity = ambient + light.rgb; - vec3 finalColor = diffuseColor.rgb * intensity; - gl_FragColor = vec4(finalColor, diffuseColor.a); -} -`;(function(r){__extends$3(e,r);function e(t,n,i){n===void 0&&(n=0),i===void 0&&(i=1);var a=r.call(this,vertex$3,fragment$3)||this;return a._color=0,a.uniforms.dimensions=new Float32Array(2),a.uniforms.ambientColor=new Float32Array([0,0,0,i]),a.texture=t,a.color=n,a}return e.prototype.apply=function(t,n,i,a){var l,u;this.uniforms.dimensions[0]=(l=n.filterFrame)===null||l===void 0?void 0:l.width,this.uniforms.dimensions[1]=(u=n.filterFrame)===null||u===void 0?void 0:u.height,t.applyFilter(this,n,i,a)},Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uLightmap},set:function(t){this.uniforms.uLightmap=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var n=this.uniforms.ambientColor;typeof t=="number"?(hex2rgb(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],this._color=rgb2hex(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.ambientColor[3]},set:function(t){this.uniforms.ambientColor[3]=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-tilt-shift - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-tilt-shift is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$2=function(r,e){return extendStatics$2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$2(r,e)};function __extends$2(r,e){extendStatics$2(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$2=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$2=`varying vec2 vTextureCoord; - -uniform sampler2D uSampler; -uniform float blur; -uniform float gradientBlur; -uniform vec2 start; -uniform vec2 end; -uniform vec2 delta; -uniform vec2 texSize; - -float random(vec3 scale, float seed) -{ - return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed); -} - -void main(void) -{ - vec4 color = vec4(0.0); - float total = 0.0; - - float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0); - vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x)); - float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur; - - for (float t = -30.0; t <= 30.0; t++) - { - float percent = (t + offset - 0.5) / 30.0; - float weight = 1.0 - abs(percent); - vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius); - sample.rgb *= sample.a; - color += sample * weight; - total += weight; - } - - color /= total; - color.rgb /= color.a + 0.00001; - - gl_FragColor = color; -} -`,TiltShiftAxisFilter=function(r){__extends$2(e,r);function e(t,n,i,a){t===void 0&&(t=100),n===void 0&&(n=600);var l=r.call(this,vertex$2,fragment$2)||this;return l.uniforms.blur=t,l.uniforms.gradientBlur=n,l.uniforms.start=i||new Point(0,window.innerHeight/2),l.uniforms.end=a||new Point(600,window.innerHeight/2),l.uniforms.delta=new Point(30,30),l.uniforms.texSize=new Point(window.innerWidth,window.innerHeight),l.updateDelta(),l}return e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(e.prototype,"blur",{get:function(){return this.uniforms.blur},set:function(t){this.uniforms.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.uniforms.gradientBlur},set:function(t){this.uniforms.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.uniforms.start},set:function(t){this.uniforms.start=t,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.uniforms.end},set:function(t){this.uniforms.end=t,this.updateDelta()},enumerable:!1,configurable:!0}),e}(Filter),TiltShiftXFilter=function(r){__extends$2(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+n*n);this.uniforms.delta.x=t/i,this.uniforms.delta.y=n/i},e}(TiltShiftAxisFilter),TiltShiftYFilter=function(r){__extends$2(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+n*n);this.uniforms.delta.x=-n/i,this.uniforms.delta.y=t/i},e}(TiltShiftAxisFilter);(function(r){__extends$2(e,r);function e(t,n,i,a){t===void 0&&(t=100),n===void 0&&(n=600);var l=r.call(this)||this;return l.tiltShiftXFilter=new TiltShiftXFilter(t,n,i,a),l.tiltShiftYFilter=new TiltShiftYFilter(t,n,i,a),l}return e.prototype.apply=function(t,n,i,a){var l=t.getFilterTexture();this.tiltShiftXFilter.apply(t,n,l,1),this.tiltShiftYFilter.apply(t,l,i,a),t.returnFilterTexture(l)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},enumerable:!1,configurable:!0}),e})(Filter);/*! - * @pixi/filter-twist - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-twist is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics$1=function(r,e){return extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics$1(r,e)};function __extends$1(r,e){extendStatics$1(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vertex$1=`attribute vec2 aVertexPosition; -attribute vec2 aTextureCoord; - -uniform mat3 projectionMatrix; - -varying vec2 vTextureCoord; - -void main(void) -{ - gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); - vTextureCoord = aTextureCoord; -}`,fragment$1=`varying vec2 vTextureCoord; - -uniform sampler2D uSampler; -uniform float radius; -uniform float angle; -uniform vec2 offset; -uniform vec4 filterArea; - -vec2 mapCoord( vec2 coord ) -{ - coord *= filterArea.xy; - coord += filterArea.zw; - - return coord; -} - -vec2 unmapCoord( vec2 coord ) -{ - coord -= filterArea.zw; - coord /= filterArea.xy; - - return coord; -} - -vec2 twist(vec2 coord) -{ - coord -= offset; - - float dist = length(coord); - - if (dist < radius) - { - float ratioDist = (radius - dist) / radius; - float angleMod = ratioDist * ratioDist * angle; - float s = sin(angleMod); - float c = cos(angleMod); - coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c); - } - - coord += offset; - - return coord; -} - -void main(void) -{ - - vec2 coord = mapCoord(vTextureCoord); - - coord = twist(coord); - - coord = unmapCoord(coord); - - gl_FragColor = texture2D(uSampler, coord ); - -} -`;(function(r){__extends$1(e,r);function e(t){var n=r.call(this,vertex$1,fragment$1)||this;return Object.assign(n,e.defaults,t),n}return Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.offset},set:function(t){this.uniforms.offset=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e.defaults={radius:200,angle:4,padding:20,offset:new Point},e})(Filter);/*! - * @pixi/filter-zoom-blur - v4.2.0 - * Compiled Fri, 05 Aug 2022 19:53:35 UTC - * - * @pixi/filter-zoom-blur is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - *//*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics=function(r,e){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},extendStatics(r,e)};function __extends(r,e){extendStatics(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function __rest(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i= 0.0 && dist > radius) { // radius < 0 means it's infinity - delta = dist - radius; - gap = gradient; - } - - if (delta > 0.0) { - float normalCount = gap / filterArea.x; - delta = (normalCount - delta) / normalCount; - countLimit *= delta; - strength *= delta; - if (countLimit < 1.0) - { - gl_FragColor = texture2D(uSampler, vTextureCoord); - return; - } - } - - // randomize the lookup values to hide the fixed number of samples - float offset = rand(vTextureCoord, 0.0); - - float total = 0.0; - vec4 color = vec4(0.0); - - dir *= strength; - - for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) { - float percent = (t + offset) / MAX_KERNEL_SIZE; - float weight = 4.0 * (percent - percent * percent); - vec2 p = vTextureCoord + dir * percent; - vec4 sample = texture2D(uSampler, p); - - // switch to pre-multiplied alpha to correctly blur transparent images - // sample.rgb *= sample.a; - - color += sample * weight; - total += weight; - - if (t > countLimit){ - break; - } - } - - color /= total; - // switch back from pre-multiplied alpha - // color.rgb /= color.a + 0.00001; - - gl_FragColor = color; -} -`;(function(r){__extends(e,r);function e(t){var n=this,i=Object.assign(e.defaults,t),a=i.maxKernelSize,l=__rest(i,["maxKernelSize"]);return n=r.call(this,vertex,fragment.replace("${maxKernelSize}",a.toFixed(1)))||this,Object.assign(n,l),n}return Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.uStrength},set:function(t){this.uniforms.uStrength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this.uniforms.uInnerRadius},set:function(t){this.uniforms.uInnerRadius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},e})(Filter);var __pow=Math.pow,__async$2=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())});class CubismBreath{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new CubismBreath}setParameters(e){this._breathParameters=e}getParameters(){return this._breathParameters}updateParameters(e,t){this._currentTime+=t;const n=this._currentTime*2*3.14159;for(let i=0;i=1&&(n=1,this._blinkingState=EyeState.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),t=1-n;break;case EyeState.EyeState_Closed:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,n>=1&&(this._blinkingState=EyeState.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),t=0;break;case EyeState.EyeState_Opening:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,n>=1&&(n=1,this._blinkingState=EyeState.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),t=n;break;case EyeState.EyeState_Interval:this._nextBlinkingTime(r[r.EyeState_First=0]="EyeState_First",r[r.EyeState_Interval=1]="EyeState_Interval",r[r.EyeState_Closing=2]="EyeState_Closing",r[r.EyeState_Closed=3]="EyeState_Closed",r[r.EyeState_Opening=4]="EyeState_Opening",r))(EyeState||{});const Epsilon=.001,DefaultFadeInSeconds=.5;class CubismPose{static create(e){const t=new CubismPose;typeof e.FadeInTime=="number"&&(t._fadeTimeSeconds=e.FadeInTime,t._fadeTimeSeconds<=0&&(t._fadeTimeSeconds=DefaultFadeInSeconds));const n=e.Groups,i=n.length;for(let a=0;aEpsilon){if(a>=0)break;a=f,l=e.getPartOpacityByIndex(m),l+=t/this._fadeTimeSeconds,l>1&&(l=1)}}a<0&&(a=0,l=1);for(let f=n;fd&&(o=1-d/(1-l)),s>o&&(s=o),e.setPartOpacityByIndex(m,s)}}}constructor(){this._fadeTimeSeconds=DefaultFadeInSeconds,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class PartData{constructor(e){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],e!=null&&this.assignment(e)}assignment(e){return this.partId=e.partId,this.link=e.link.map(t=>t.clone()),this}initialize(e){this.parameterIndex=e.getParameterIndex(this.partId),this.partIndex=e.getPartIndex(this.partId),e.setParameterValueByIndex(this.parameterIndex,1)}clone(){const e=new PartData;return e.partId=this.partId,e.parameterIndex=this.parameterIndex,e.partIndex=this.partIndex,e.link=this.link.map(t=>t.clone()),e}}class CubismVector2{constructor(e,t){this.x=e||0,this.y=t||0}add(e){const t=new CubismVector2(0,0);return t.x=this.x+e.x,t.y=this.y+e.y,t}substract(e){const t=new CubismVector2(0,0);return t.x=this.x-e.x,t.y=this.y-e.y,t}multiply(e){const t=new CubismVector2(0,0);return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByScaler(e){return this.multiply(new CubismVector2(e,e))}division(e){const t=new CubismVector2(0,0);return t.x=this.x/e.x,t.y=this.y/e.y,t}divisionByScalar(e){return this.division(new CubismVector2(e,e))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(e){return Math.sqrt((this.x-e.x)*(this.x-e.x)+(this.y-e.y)*(this.y-e.y))}dot(e){return this.x*e.x+this.y*e.y}normalize(){const e=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/e,this.y=this.y/e}isEqual(e){return this.x==e.x&&this.y==e.y}isNotEqual(e){return!this.isEqual(e)}}const _CubismMath=class{static range(r,e,t){return rt&&(r=t),r}static sin(r){return Math.sin(r)}static cos(r){return Math.cos(r)}static abs(r){return Math.abs(r)}static sqrt(r){return Math.sqrt(r)}static cbrt(r){if(r===0)return r;let e=r;const t=e<0;t&&(e=-e);let n;return e===1/0?n=1/0:(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3),t?-n:n}static getEasingSine(r){return r<0?0:r>1?1:.5-.5*this.cos(r*Math.PI)}static max(r,e){return r>e?r:e}static min(r,e){return r>e?e:r}static degreesToRadian(r){return r/180*Math.PI}static radianToDegrees(r){return r*180/Math.PI}static directionToRadian(r,e){const t=Math.atan2(e.y,e.x),n=Math.atan2(r.y,r.x);let i=t-n;for(;i<-Math.PI;)i+=Math.PI*2;for(;i>Math.PI;)i-=Math.PI*2;return i}static directionToDegrees(r,e){const t=this.directionToRadian(r,e);let n=this.radianToDegrees(t);return e.x-r.x>0&&(n=-n),n}static radianToDirection(r){const e=new CubismVector2;return e.x=this.sin(r),e.y=this.cos(r),e}static quadraticEquation(r,e,t){return this.abs(r)<_CubismMath.Epsilon?this.abs(e)<_CubismMath.Epsilon?-t:-t/e:-(e+this.sqrt(e*e-4*r*t))/(2*r)}static cardanoAlgorithmForBezier(r,e,t,n){if(this.sqrt(r)<_CubismMath.Epsilon)return this.range(this.quadraticEquation(e,t,n),0,1);const i=e/r,a=t/r,l=n/r,u=(3*a-i*i)/3,d=u/3,f=(2*i*i*i-9*i*a+27*l)/27,m=f/2,s=m*m+d*d*d,o=.5,c=o+.01;if(s<0){const x=-u/3,w=x*x*x,S=this.sqrt(w),T=-f/(2*S),E=this.range(T,-1,1),M=Math.acos(E),A=2*this.cbrt(S),C=A*this.cos(M/3)-i/3;if(this.abs(C-o)1&&(e=1),t<0?t=0:t>1&&(t=1),n<0?n=0:n>1&&(n=1),i<0?i=0:i>1&&(i=1),this._modelColor.R=e,this._modelColor.G=t,this._modelColor.B=n,this._modelColor.A=i}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(e){this._isPremultipliedAlpha=e}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(e){this._isCulling=e}isCulling(){return this._isCulling}setAnisotropy(e){this._anisortopy=e}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new CubismTextureColor,this._mvpMatrix4x4=new CubismMatrix44,this._mvpMatrix4x4.loadIdentity()}}var CubismBlendMode=(r=>(r[r.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",r[r.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",r[r.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",r))(CubismBlendMode||{});class CubismTextureColor{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let s_isStarted=!1,s_isInitialized=!1,s_option;const Constant={vertexOffset:0,vertexStep:2};class CubismFramework{static startUp(e){if(s_isStarted)return CubismLogInfo("CubismFramework.startUp() is already done."),s_isStarted;if(Live2DCubismCore._isStarted)return s_isStarted=!0,!0;if(Live2DCubismCore._isStarted=!0,s_option=e,s_option&&Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction),s_isStarted=!0,s_isStarted){const t=Live2DCubismCore.Version.csmGetVersion(),n=(t&4278190080)>>24,i=(t&16711680)>>16,a=t&65535,l=t;CubismLogInfo("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+i).slice(-2),("0000"+a).slice(-4),l)}return CubismLogInfo("CubismFramework.startUp() is complete."),s_isStarted}static cleanUp(){s_isStarted=!1,s_isInitialized=!1,s_option=void 0}static initialize(){if(!s_isStarted){CubismLogWarning("CubismFramework is not started.");return}if(s_isInitialized){CubismLogWarning("CubismFramework.initialize() skipped, already initialized.");return}s_isInitialized=!0,CubismLogInfo("CubismFramework.initialize() is complete.")}static dispose(){if(!s_isStarted){CubismLogWarning("CubismFramework is not started.");return}if(!s_isInitialized){CubismLogWarning("CubismFramework.dispose() skipped, not initialized.");return}CubismRenderer.staticRelease(),s_isInitialized=!1,CubismLogInfo("CubismFramework.dispose() is complete.")}static isStarted(){return s_isStarted}static isInitialized(){return s_isInitialized}static coreLogFunction(e){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(e)}static getLoggingLevel(){return s_option!=null?s_option.loggingLevel:LogLevel.LogLevel_Off}constructor(){}}var LogLevel=(r=>(r[r.LogLevel_Verbose=0]="LogLevel_Verbose",r[r.LogLevel_Debug=1]="LogLevel_Debug",r[r.LogLevel_Info=2]="LogLevel_Info",r[r.LogLevel_Warning=3]="LogLevel_Warning",r[r.LogLevel_Error=4]="LogLevel_Error",r[r.LogLevel_Off=5]="LogLevel_Off",r))(LogLevel||{});const CSM_ASSERT=()=>{};function CubismLogDebug(r,...e){CubismDebug.print(LogLevel.LogLevel_Debug,"[CSM][D]"+r+` -`,e)}function CubismLogInfo(r,...e){CubismDebug.print(LogLevel.LogLevel_Info,"[CSM][I]"+r+` -`,e)}function CubismLogWarning(r,...e){CubismDebug.print(LogLevel.LogLevel_Warning,"[CSM][W]"+r+` -`,e)}function CubismLogError(r,...e){CubismDebug.print(LogLevel.LogLevel_Error,"[CSM][E]"+r+` -`,e)}class CubismDebug{static print(e,t,n){if(en[u]);i(a)}static dumpBytes(e,t,n){for(let i=0;i0?this.print(e,` -`):i%8==0&&i>0&&this.print(e," "),this.print(e,"{0} ",[t[i]&255]);this.print(e,` -`)}constructor(){}}class CubismModel{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const e=this._model.parameters.count,t=this._savedParameters.length;for(let n=0;nt&&(t=this._model.parameters.minimumValues[e]),this._parameterValues[e]=n==1?t:this._parameterValues[e]=this._parameterValues[e]*(1-n)+t*n}setParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.setParameterValueByIndex(i,t,n)}addParameterValueByIndex(e,t,n=1){this.setParameterValueByIndex(e,this.getParameterValueByIndex(e)+t*n)}addParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.addParameterValueByIndex(i,t,n)}multiplyParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.multiplyParameterValueByIndex(i,t,n)}multiplyParameterValueByIndex(e,t,n=1){this.setParameterValueByIndex(e,this.getParameterValueByIndex(e)*(1+(t-1)*n))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(e){const t=this._model.drawables.count;for(let n=0;nt&&(e=t);for(let n=0;n0&&t.getEndTime()(r[r.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",r[r.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",r[r.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",r))(ExpressionBlendType||{}),CubismConfig;(r=>{r.supportMoreMaskDivisions=!0,r.setOpacityFromMotion=!1})(CubismConfig||(CubismConfig={}));var CubismMotionCurveTarget=(r=>(r[r.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",r[r.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",r[r.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",r))(CubismMotionCurveTarget||{}),CubismMotionSegmentType=(r=>(r[r.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",r[r.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",r[r.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",r[r.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",r))(CubismMotionSegmentType||{});class CubismMotionPoint{constructor(e=0,t=0){this.time=e,this.value=t}}class CubismMotionSegment{constructor(){this.basePointIndex=0,this.segmentType=0}}class CubismMotionCurve{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class CubismMotionEvent{constructor(){this.fireTime=0,this.value=""}}class CubismMotionData{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class CubismMotionJson{constructor(e){this._json=e}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(e){return EvaluationOptionFlag.EvaluationOptionFlag_AreBeziersRistricted==e?!!this._json.Meta.AreBeziersRestricted:!1}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(e){return this._json.Curves[e].Target}getMotionCurveId(e){return this._json.Curves[e].Id}getMotionCurveFadeInTime(e){return this._json.Curves[e].FadeInTime}getMotionCurveFadeOutTime(e){return this._json.Curves[e].FadeOutTime}getMotionCurveSegmentCount(e){return this._json.Curves[e].Segments.length}getMotionCurveSegment(e,t){return this._json.Curves[e].Segments[t]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(e){return this._json.UserData[e].Time}getEventValue(e){return this._json.UserData[e].Value}}var EvaluationOptionFlag=(r=>(r[r.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",r))(EvaluationOptionFlag||{});const EffectNameEyeBlink="EyeBlink",EffectNameLipSync="LipSync",TargetNameModel="Model",TargetNameParameter="Parameter",TargetNamePartOpacity="PartOpacity",UseOldBeziersCurveMotion=!1;function lerpPoints(r,e,t){const n=new CubismMotionPoint;return n.time=r.time+(e.time-r.time)*t,n.value=r.value+(e.value-r.value)*t,n}function linearEvaluate(r,e){let t=(e-r[0].time)/(r[1].time-r[0].time);return t<0&&(t=0),r[0].value+(r[1].value-r[0].value)*t}function bezierEvaluate(r,e){let t=(e-r[0].time)/(r[3].time-r[0].time);t<0&&(t=0);const n=lerpPoints(r[0],r[1],t),i=lerpPoints(r[1],r[2],t),a=lerpPoints(r[2],r[3],t),l=lerpPoints(n,i,t),u=lerpPoints(i,a,t);return lerpPoints(l,u,t).value}function bezierEvaluateCardanoInterpretation(r,e){const t=e,n=r[0].time,i=r[3].time,a=r[1].time,l=r[2].time,u=i-3*l+3*a-n,d=3*l-6*a+3*n,f=3*a-3*n,m=n-t,s=CubismMath.cardanoAlgorithmForBezier(u,d,f,m),o=lerpPoints(r[0],r[1],s),c=lerpPoints(r[1],r[2],s),v=lerpPoints(r[2],r[3],s),y=lerpPoints(o,c,s),_=lerpPoints(c,v,s);return lerpPoints(y,_,s).value}function steppedEvaluate(r,e){return r[0].value}function inverseSteppedEvaluate(r,e){return r[1].value}function evaluateCurve(r,e,t){const n=r.curves[e];let i=-1;const a=n.baseSegmentIndex+n.segmentCount;let l=0;for(let d=n.baseSegmentIndex;dt){i=d;break}if(i==-1)return r.points[l].value;const u=r.segments[i];return u.evaluate(r.points.slice(u.basePointIndex),t)}class CubismMotion extends ACubismMotion{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(e,t){const n=new CubismMotion;return n.parse(e),n._sourceFrameRate=n._motionData.fps,n._loopDurationSeconds=n._motionData.duration,n._onFinishedMotion=t,n}doUpdateParameters(e,t,n,i){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=EffectNameEyeBlink),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=EffectNameLipSync);let a=t-i.getStartTime();a<0&&(a=0);let l=Number.MAX_VALUE,u=Number.MAX_VALUE;const d=64;let f=0,m=0;this._eyeBlinkParameterIds.length>d&&CubismLogDebug("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>d&&CubismLogDebug("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const s=this._fadeInSeconds<=0?1:CubismMath.getEasingSine((t-i.getFadeInStartTime())/this._fadeInSeconds),o=this._fadeOutSeconds<=0||i.getEndTime()<0?1:CubismMath.getEasingSine((i.getEndTime()-t)/this._fadeOutSeconds);let c,v,y,_=a;if(this._isLoop)for(;_>this._motionData.duration;)_-=this._motionData.duration;const b=this._motionData.curves;for(v=0;v>x&1)continue;const S=w+(u-w)*n;e.setParameterValueById(this._eyeBlinkParameterIds[x],S)}if(l!=Number.MAX_VALUE)for(let x=0;x>x&1)continue;const S=w+(l-w)*n;e.setParameterValueById(this._lipSyncParameterIds[x],S)}}for(;v=this._motionData.duration&&(this._isLoop?(i.setStartTime(t),this._isLoopFadeIn&&i.setFadeInStartTime(t)):(this._onFinishedMotion&&this._onFinishedMotion(this),i.setIsFinished(!0))),this._lastWeight=n}setIsLoop(e){this._isLoop=e}isLoop(){return this._isLoop}setIsLoopFadeIn(e){this._isLoopFadeIn=e}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(e,t){const n=this._motionData.curves;for(let i=0;inew CubismMotionCurve),this._motionData.segments=Array.from({length:t.getMotionTotalSegmentCount()}).map(()=>new CubismMotionSegment),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new CubismMotionEvent),this._motionData.points=[];let l=0,u=0;for(let d=0;de&&this._motionData.events[n].fireTime<=t&&this._firedEventValues.push(this._motionData.events[n].value);return this._firedEventValues}}class CubismMotionQueueEntry{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(e){this._fadeOutSeconds=e,this._isTriggeredFadeOut=!0}startFadeOut(e,t){const n=t+e;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||nt!=null&&t._motionQueueEntryHandle==e)}setEventCallback(e,t=null){this._eventCallBack=e,this._eventCustomData=t}doUpdateMotion(e,t){let n=!1,i=0;for(;i(r[r.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",r))(CubismPhysicsTargetType||{}),CubismPhysicsSource=(r=>(r[r.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",r[r.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",r[r.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",r))(CubismPhysicsSource||{});class CubismPhysicsParticle{constructor(){this.initialPosition=new CubismVector2(0,0),this.position=new CubismVector2(0,0),this.lastPosition=new CubismVector2(0,0),this.lastGravity=new CubismVector2(0,0),this.force=new CubismVector2(0,0),this.velocity=new CubismVector2(0,0)}}class CubismPhysicsSubRig{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class CubismPhysicsInput{constructor(){this.source={}}}class CubismPhysicsOutput{constructor(){this.destination={},this.translationScale=new CubismVector2(0,0)}}class CubismPhysicsRig{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new CubismVector2(0,0),this.wind=new CubismVector2(0,0)}}class CubismPhysicsJson{constructor(e){this._json=e}release(){this._json=void 0}getGravity(){const e=new CubismVector2(0,0);return e.x=this._json.Meta.EffectiveForces.Gravity.X,e.y=this._json.Meta.EffectiveForces.Gravity.Y,e}getWind(){const e=new CubismVector2(0,0);return e.x=this._json.Meta.EffectiveForces.Wind.X,e.y=this._json.Meta.EffectiveForces.Wind.Y,e}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Default}getNormalizationAngleMinimumValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Default}getInputCount(e){return this._json.PhysicsSettings[e].Input.length}getInputWeight(e,t){return this._json.PhysicsSettings[e].Input[t].Weight}getInputReflect(e,t){return this._json.PhysicsSettings[e].Input[t].Reflect}getInputType(e,t){return this._json.PhysicsSettings[e].Input[t].Type}getInputSourceId(e,t){return this._json.PhysicsSettings[e].Input[t].Source.Id}getOutputCount(e){return this._json.PhysicsSettings[e].Output.length}getOutputVertexIndex(e,t){return this._json.PhysicsSettings[e].Output[t].VertexIndex}getOutputAngleScale(e,t){return this._json.PhysicsSettings[e].Output[t].Scale}getOutputWeight(e,t){return this._json.PhysicsSettings[e].Output[t].Weight}getOutputDestinationId(e,t){return this._json.PhysicsSettings[e].Output[t].Destination.Id}getOutputType(e,t){return this._json.PhysicsSettings[e].Output[t].Type}getOutputReflect(e,t){return this._json.PhysicsSettings[e].Output[t].Reflect}getParticleCount(e){return this._json.PhysicsSettings[e].Vertices.length}getParticleMobility(e,t){return this._json.PhysicsSettings[e].Vertices[t].Mobility}getParticleDelay(e,t){return this._json.PhysicsSettings[e].Vertices[t].Delay}getParticleAcceleration(e,t){return this._json.PhysicsSettings[e].Vertices[t].Acceleration}getParticleRadius(e,t){return this._json.PhysicsSettings[e].Vertices[t].Radius}getParticlePosition(e,t){const n=new CubismVector2(0,0);return n.x=this._json.PhysicsSettings[e].Vertices[t].Position.X,n.y=this._json.PhysicsSettings[e].Vertices[t].Position.Y,n}}const PhysicsTypeTagX="X",PhysicsTypeTagY="Y",PhysicsTypeTagAngle="Angle",AirResistance=5,MaximumWeight=100,MovementThreshold=.001;class CubismPhysics{static create(e){const t=new CubismPhysics;return t.parse(e),t._physicsRig.gravity.y=0,t}evaluate(e,t){let n,i,a,l;const u=new CubismVector2;let d,f,m,s,o,c,v,y;o=e.getModel().parameters.values,c=e.getModel().parameters.maximumValues,v=e.getModel().parameters.minimumValues,y=e.getModel().parameters.defaultValues;for(let _=0;_=d.particleCount)break;m[b].destinationParameterIndex==-1&&(m[b].destinationParameterIndex=e.getParameterIndex(m[b].destination.id));const w=new CubismVector2;w.x=s[x].position.x-s[x-1].position.x,w.y=s[x].position.y-s[x-1].position.y,l=m[b].getValue(w,s,x,m[b].reflect,this._options.gravity);const S=m[b].destinationParameterIndex,T=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(o.subarray(S))):o.slice(S);updateOutputParameterValue(T,v[S],c[S],l,m[b]);for(let E=S,M=0;E=2?i=e[t-1].position.substract(e[t-2].position):i=i.multiplyByScaler(-1),a=CubismMath.directionToRadian(i,r),n&&(a*=-1),a}function getRangeValue(r,e){return Math.abs(Math.max(r,e)-Math.min(r,e))}function getDefaultValue(r,e){return Math.min(r,e)+getRangeValue(r,e)/2}function getOutputScaleTranslationX(r,e){return r.x}function getOutputScaleTranslationY(r,e){return r.y}function getOutputScaleAngle(r,e){return e}function updateParticles(r,e,t,n,i,a,l,u){let d,f,m,s,o=new CubismVector2(0,0),c=new CubismVector2(0,0),v=new CubismVector2(0,0),y=new CubismVector2(0,0);r[0].position=new CubismVector2(t.x,t.y),d=CubismMath.degreesToRadian(n),s=CubismMath.radianToDirection(d),s.normalize();for(let _=1;_t&&(l>i.valueExceededMaximum&&(i.valueExceededMaximum=l),l=t),u=i.weight/MaximumWeight,u>=1||(l=r[0]*(1-u)+l*u),r[0]=l}function normalizeParameterValue(r,e,t,n,i,a,l,u){let d=0;const f=CubismMath.max(t,e);fr&&(r=m);const s=CubismMath.min(i,a),o=CubismMath.max(i,a),c=l,v=getDefaultValue(m,f),y=r-v;switch(Math.sign(y)){case 1:{const _=o-c,b=f-v;b!=0&&(d=y*(_/b),d+=c);break}case-1:{const _=s-c,b=m-v;b!=0&&(d=y*(_/b),d+=c);break}case 0:{d=c;break}}return u?d:d*-1}class csmRect{constructor(e=0,t=0,n=0,i=0){this.x=e,this.y=t,this.width=n,this.height=i}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(e){this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height}expand(e,t){this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2}}const ColorChannelCount=4,shaderCount=10;let s_instance,s_viewport,s_fbo;class CubismClippingManager_WebGL{getChannelFlagAsColor(e){return this._channelColors[e]}getMaskRenderTexture(){let e=0;if(this._maskTexture&&this._maskTexture.texture!=0&&(this._maskTexture.frameNo=this._currentFrameNo,e=this._maskTexture.texture),e==0){const t=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,t,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),e=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,e),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,s_fbo),this._maskTexture=new CubismRenderTextureResource(this._currentFrameNo,e)}return e}setGL(e){this.gl=e}calcClippedDrawTotalBounds(e,t){let n=Number.MAX_VALUE,i=Number.MAX_VALUE,a=Number.MIN_VALUE,l=Number.MIN_VALUE;const u=t._clippedDrawableIndexList.length;for(let d=0;dv&&(v=x),wy&&(y=w)}if(o!=Number.MAX_VALUE)if(oa&&(a=v),y>l&&(l=y),n==Number.MAX_VALUE)t._allClippedDrawRect.x=0,t._allClippedDrawRect.y=0,t._allClippedDrawRect.width=0,t._allClippedDrawRect.height=0,t._isUsing=!1;else{t._isUsing=!0;const b=a-n,x=l-i;t._allClippedDrawRect.x=n,t._allClippedDrawRect.y=i,t._allClippedDrawRect.width=b,t._allClippedDrawRect.height=x}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new csmRect,this._tmpMatrix=new CubismMatrix44,this._tmpMatrixForMask=new CubismMatrix44,this._tmpMatrixForDraw=new CubismMatrix44;let e=new CubismTextureColor;e.R=1,e.G=0,e.B=0,e.A=0,this._channelColors.push(e),e=new CubismTextureColor,e.R=0,e.G=1,e.B=0,e.A=0,this._channelColors.push(e),e=new CubismTextureColor,e.R=0,e.G=0,e.B=1,e.A=0,this._channelColors.push(e),e=new CubismTextureColor,e.R=0,e.G=0,e.B=0,e.A=1,this._channelColors.push(e)}release(){var e,t,n;const i=this;for(let a=0;a0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),t.getMvpMatrix(),t.preDraw(),this.setupLayoutBounds(n),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let i=0;i(r[r.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",r[r.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",r[r.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",r[r.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",r[r.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",r[r.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",r[r.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",r[r.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",r[r.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",r[r.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",r))(ShaderNames||{});const vertexShaderSrcSetupMask="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",fragmentShaderSrcsetupMask="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",vertexShaderSrc="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",vertexShaderSrcMasked="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",fragmentShaderSrcPremultipliedAlpha="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",fragmentShaderSrcMaskPremultipliedAlpha="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",fragmentShaderSrcMaskInvertedPremultipliedAlpha="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class CubismRenderer_WebGL extends CubismRenderer{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new CubismClippingManager_WebGL,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(e){e.isUsingMasking()&&(this._clippingManager=new CubismClippingManager_WebGL,this._clippingManager.initialize(e,e.getDrawableCount(),e.getDrawableMasks(),e.getDrawableMaskCounts()));for(let t=e.getDrawableCount()-1;t>=0;t--)this._sortedDrawableIndexList[t]=0;super.initialize(e)}bindTexture(e,t){this._textures[e]=t}getBindedTextures(){return this._textures}setClippingMaskBufferSize(e){this._clippingManager.release(),this._clippingManager=new CubismClippingManager_WebGL,this._clippingManager.setClippingMaskBufferSize(e),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var e,t,n;const i=this;this._clippingManager.release(),i._clippingManager=void 0,(e=this.gl)==null||e.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(t=this.gl)==null||t.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,(n=this.gl)==null||n.deleteBuffer(this._bufferData.index),this._bufferData.index=null,i._bufferData=void 0,i._textures=void 0}doDrawModel(){this.preDraw(),this._clippingManager!=null&&this._clippingManager.setupClippingContext(this.getModel(),this);const e=this.getModel().getDrawableCount(),t=this.getModel().getDrawableRenderOrders();for(let n=0;n{CubismRenderer_WebGL.doStaticRelease()};class CubismModelSettingsJson{constructor(e){this.groups=e.Groups,this.hitAreas=e.HitAreas,this.layout=e.Layout,this.moc=e.FileReferences.Moc,this.expressions=e.FileReferences.Expressions,this.motions=e.FileReferences.Motions,this.textures=e.FileReferences.Textures,this.physics=e.FileReferences.Physics,this.pose=e.FileReferences.Pose}getEyeBlinkParameters(){var e,t;return(t=(e=this.groups)==null?void 0:e.find(n=>n.Name==="EyeBlink"))==null?void 0:t.Ids}getLipSyncParameters(){var e,t;return(t=(e=this.groups)==null?void 0:e.find(n=>n.Name==="LipSync"))==null?void 0:t.Ids}}const ParamAngleX="ParamAngleX",ParamAngleY="ParamAngleY",ParamAngleZ="ParamAngleZ",ParamEyeBallX="ParamEyeBallX",ParamEyeBallY="ParamEyeBallY",ParamBodyAngleX="ParamBodyAngleX",ParamBreath="ParamBreath",LOGICAL_WIDTH=2,LOGICAL_HEIGHT=2;var config;(r=>{r.LOG_LEVEL_VERBOSE=0,r.LOG_LEVEL_WARNING=1,r.LOG_LEVEL_ERROR=2,r.LOG_LEVEL_NONE=999,r.logLevel=r.LOG_LEVEL_WARNING,r.sound=!0,r.motionSync=!0,r.motionFadingDuration=500,r.idleMotionFadingDuration=2e3,r.expressionFadingDuration=500,r.preserveExpressionOnMotion=!0,r.cubism4=CubismConfig})(config||(config={}));const logger={log(r,...e){config.logLevel<=config.LOG_LEVEL_VERBOSE&&console.log(`[${r}]`,...e)},warn(r,...e){config.logLevel<=config.LOG_LEVEL_WARNING&&console.warn(`[${r}]`,...e)},error(r,...e){config.logLevel<=config.LOG_LEVEL_ERROR&&console.error(`[${r}]`,...e)}};function clamp(r,e,t){return rt?t:r}function applyMixins(r,e){e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}function folderName(r){let e=r.lastIndexOf("/");return e!=-1&&(r=r.slice(0,e)),e=r.lastIndexOf("/"),e!==-1&&(r=r.slice(e+1)),r}function remove(r,e){const t=r.indexOf(e);t!==-1&&r.splice(t,1)}class ExpressionManager extends EventEmitter{constructor(e,t){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=e,this.tag=`ExpressionManager(${e.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(e){return __async$2(this,null,function*(){if(!this.definitions[e]){logger.warn(this.tag,`Undefined expression at [${e}]`);return}if(this.expressions[e]===null){logger.warn(this.tag,`Cannot set expression at [${e}] because it's already failed in loading.`);return}if(this.expressions[e])return this.expressions[e];const t=yield this._loadExpression(e);return this.expressions[e]=t,t})}_loadExpression(e){throw new Error("Not implemented.")}setRandomExpression(){return __async$2(this,null,function*(){if(this.definitions.length){const e=[];for(let t=0;t-1&&ef&&(l*=f/d,u*=f/d),this.vx+=l,this.vy+=u;const m=Math.sqrt(__pow(this.vx,2)+__pow(this.vy,2)),s=.5*(Math.sqrt(__pow(f,2)+8*f*i)-f);m>s&&(this.vx*=s/m,this.vy*=s/m),this.x+=this.vx,this.y+=this.vy}}class ModelSettings{constructor(e){this.json=e;let t=e.url;if(typeof t!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=t,this.name=folderName(this.url)}resolveURL(e){return url.resolve(this.url,e)}replaceFiles(e){this.moc=e(this.moc,"moc"),this.pose!==void 0&&(this.pose=e(this.pose,"pose")),this.physics!==void 0&&(this.physics=e(this.physics,"physics"));for(let t=0;t(e.push(t),t)),e}validateFiles(e){const t=(a,l)=>{const u=this.resolveURL(a);if(!e.includes(u)){if(l)throw new Error(`File "${a}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(a=>t(a,!0)),this.getDefinedFiles().filter(a=>t(a,!1))}}var MotionPriority=(r=>(r[r.NONE=0]="NONE",r[r.IDLE=1]="IDLE",r[r.NORMAL=2]="NORMAL",r[r.FORCE=3]="FORCE",r))(MotionPriority||{});class MotionState{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(e,t,n){if(n<=0)return logger.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(e===this.currentGroup&&t===this.currentIndex)return logger.log(this.tag,"Motion is already playing.",this.dump(e,t)),!1;if(e===this.reservedGroup&&t===this.reservedIndex||e===this.reservedIdleGroup&&t===this.reservedIdleIndex)return logger.log(this.tag,"Motion is already reserved.",this.dump(e,t)),!1;if(n===1){if(this.currentPriority!==0)return logger.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,t)),!1;if(this.reservedIdleGroup!==void 0)return logger.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(e,t)),!1;this.setReservedIdle(e,t)}else{if(n<3){if(n<=this.currentPriority)return logger.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(e,t)),!1;if(n<=this.reservePriority)return logger.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(e,t)),!1}this.setReserved(e,t,n)}return!0}start(e,t,n,i){if(i===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return logger.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,n)),!1}else{if(t!==this.reservedGroup||n!==this.reservedIndex)return logger.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(t,n)),!1;this.setReserved(void 0,void 0,0)}return e?(this.setCurrent(t,n,i),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(e,t,n){this.currentPriority=n,this.currentGroup=e,this.currentIndex=t}setReserved(e,t,n){this.reservePriority=n,this.reservedGroup=e,this.reservedIndex=t}setReservedIdle(e,t){this.reservedIdleGroup=e,this.reservedIdleIndex=t}isActive(e,t){return e===this.currentGroup&&t===this.currentIndex||e===this.reservedGroup&&t===this.reservedIndex||e===this.reservedIdleGroup&&t===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return this.currentGroup===void 0&&this.reservedIdleGroup===void 0}shouldOverrideExpression(){return!config.preserveExpressionOnMotion&&this.currentPriority>1}dump(e,t){if(this.debug){const n=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return` - group = "${e}", index = ${t} -`+n.map(i=>"["+i+"] "+this[i]).join(` -`)}return""}}const TAG$2="SoundManager",VOLUME=.5;class SoundManager{static get volume(){return this._volume}static set volume(e){this._volume=(e>1?1:e<0?0:e)||0,this.audios.forEach(t=>t.volume=this._volume)}static add(e,t,n){const i=new Audio(e);return i.volume=this._volume,i.preload="auto",i.addEventListener("ended",()=>{this.dispose(i),t==null||t()}),i.addEventListener("error",a=>{this.dispose(i),logger.warn(TAG$2,`Error occurred on "${e}"`,a.error),n==null||n(a.error)}),this.audios.push(i),i}static play(e){return new Promise((t,n)=>{var i;(i=e.play())==null||i.catch(a=>{e.dispatchEvent(new ErrorEvent("error",{error:a})),n(a)}),e.readyState===e.HAVE_ENOUGH_DATA?t():e.addEventListener("canplaythrough",t)})}static dispose(e){e.pause(),e.removeAttribute("src"),remove(this.audios,e)}static destroy(){for(let e=this.audios.length-1;e>=0;e--)this.dispose(this.audios[e])}}SoundManager.audios=[];SoundManager._volume=VOLUME;var MotionPreloadStrategy=(r=>(r.ALL="ALL",r.IDLE="IDLE",r.NONE="NONE",r))(MotionPreloadStrategy||{});class MotionManager extends EventEmitter{constructor(e,t){super(),this.motionGroups={},this.state=new MotionState,this.playing=!1,this.destroyed=!1,this.settings=e,this.tag=`MotionManager(${e.name})`,this.state.tag=this.tag}init(e){e!=null&&e.idleMotionGroup&&(this.groups.idle=e.idleMotionGroup),this.setupMotions(e),this.stopAllMotions()}setupMotions(e){for(const n of Object.keys(this.definitions))this.motionGroups[n]=[];let t;switch(e==null?void 0:e.motionPreload){case"NONE":return;case"ALL":t=Object.keys(this.definitions);break;case"IDLE":default:t=[this.groups.idle];break}for(const n of t)if(this.definitions[n])for(let i=0;ithis.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=d}catch(s){logger.warn(this.tag,"Failed to create audio",m,s)}}const f=yield this.loadMotion(n,i);if(d){const m=SoundManager.play(d).catch(s=>logger.warn(this.tag,"Failed to play audio",d.src,s));config.motionSync&&(yield m)}return this.state.start(f,n,i,a)?(logger.log(this.tag,"Start motion:",this.getMotionName(u)),this.emit("motionStart",n,i,d),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(f),!0):(d&&(SoundManager.dispose(d),this.currentAudio=void 0),!1)})}startRandomMotion(e,t){return __async$2(this,null,function*(){const n=this.definitions[e];if(n!=null&&n.length){const i=[];for(let a=0;at.index>=0);for(const t of e)this.hitAreas[t.name]=t}hitTest(e,t){return Object.keys(this.hitAreas).filter(n=>this.isHit(n,e,t))}isHit(e,t,n){if(!this.hitAreas[e])return!1;const i=this.hitAreas[e].index,a=this.getDrawableBounds(i,tempBounds);return a.x<=t&&t<=a.x+a.width&&a.y<=n&&n<=a.y+a.height}getDrawableBounds(e,t){const n=this.getDrawableVertices(e);let i=n[0],a=n[0],l=n[1],u=n[1];for(let d=0;d{(a.status===200||a.status===0)&&a.response?n(a.response):a.onerror()},a.onerror=()=>{logger.warn(TAG$1,`Failed to load resource as ${a.responseType} (Status ${a.status}): ${e}`),i(new NetworkError("Network error.",e,a.status))},a.onabort=()=>i(new NetworkError("Aborted.",e,a.status,!0)),a.onloadend=()=>{var l;_XHRLoader.allXhrSet.delete(a),r&&((l=_XHRLoader.xhrMap.get(r))==null||l.delete(a))},a}static cancelXHRs(){var r;(r=_XHRLoader.xhrMap.get(this))==null||r.forEach(e=>{e.abort(),_XHRLoader.allXhrSet.delete(e)}),_XHRLoader.xhrMap.delete(this)}static release(){_XHRLoader.allXhrSet.forEach(r=>r.abort()),_XHRLoader.allXhrSet.clear(),_XHRLoader.xhrMap=new WeakMap}};let XHRLoader=_XHRLoader;XHRLoader.xhrMap=new WeakMap;XHRLoader.allXhrSet=new Set;XHRLoader.loader=(r,e)=>new Promise((t,n)=>{_XHRLoader.createXHR(r.target,r.settings?r.settings.resolveURL(r.url):r.url,r.type,a=>{r.result=a,t()},n).send()});function runMiddlewares(r,e){let t=-1;return n(0);function n(i,a){if(a)return Promise.reject(a);if(i<=t)return Promise.reject(new Error("next() called multiple times"));t=i;const l=r[i];if(!l)return Promise.resolve();try{return Promise.resolve(l(e,n.bind(null,i+1)))}catch(u){return Promise.reject(u)}}}class Live2DLoader{static load(e){return runMiddlewares(this.middlewares,e).then(()=>e.result)}}Live2DLoader.middlewares=[XHRLoader.loader];function createTexture(r,e={}){var t;const n={resourceOptions:{crossorigin:e.crossOrigin}};if(Texture.fromURL)return Texture.fromURL(r,n).catch(l=>{if(l instanceof Error)throw l;const u=new Error("Texture loading error");throw u.event=l,u});n.resourceOptions.autoLoad=!1;const i=Texture.from(r,n);if(i.baseTexture.valid)return Promise.resolve(i);const a=i.baseTexture.resource;return(t=a._live2d_load)!=null||(a._live2d_load=new Promise((l,u)=>{const d=f=>{a.source.removeEventListener("error",d);const m=new Error("Texture loading error");m.event=f,u(m)};a.source.addEventListener("error",d),a.load().then(()=>l(i)).catch(d)})),a._live2d_load}const TAG="Live2DFactory",urlToJSON=(r,e)=>__async$2(void 0,null,function*(){if(typeof r.source=="string"){const t=yield Live2DLoader.load({url:r.source,type:"json",target:r.live2dModel});t.url=r.source,r.source=t,r.live2dModel.emit("settingsJSONLoaded",t)}return e()}),jsonToSettings=(r,e)=>__async$2(void 0,null,function*(){if(r.source instanceof ModelSettings)return r.settings=r.source,e();if(typeof r.source=="object"){const t=Live2DFactory.findRuntime(r.source);if(t){const n=t.createModelSettings(r.source);return r.settings=n,r.live2dModel.emit("settingsLoaded",n),e()}}throw new TypeError("Unknown settings format.")}),waitUntilReady=(r,e)=>{if(r.settings){const t=Live2DFactory.findRuntime(r.settings);if(t)return t.ready().then(e)}return e()},setupOptionals=(r,e)=>__async$2(void 0,null,function*(){yield e();const t=r.internalModel;if(t){const n=r.settings,i=Live2DFactory.findRuntime(n);if(i){const a=[];n.pose&&a.push(Live2DLoader.load({settings:n,url:n.pose,type:"json",target:t}).then(l=>{t.pose=i.createPose(t.coreModel,l),r.live2dModel.emit("poseLoaded",t.pose)}).catch(l=>{r.live2dModel.emit("poseLoadError",l),logger.warn(TAG,"Failed to load pose.",l)})),n.physics&&a.push(Live2DLoader.load({settings:n,url:n.physics,type:"json",target:t}).then(l=>{t.physics=i.createPhysics(t.coreModel,l),r.live2dModel.emit("physicsLoaded",t.physics)}).catch(l=>{r.live2dModel.emit("physicsLoadError",l),logger.warn(TAG,"Failed to load physics.",l)})),a.length&&(yield Promise.all(a))}}}),setupEssentials=(r,e)=>__async$2(void 0,null,function*(){if(r.settings){const t=r.live2dModel,n=r.settings.textures.map(i=>{const a=r.settings.resolveURL(i);return createTexture(a,{crossOrigin:r.options.crossOrigin})});if(yield e(),r.internalModel)t.internalModel=r.internalModel,t.emit("modelLoaded",r.internalModel);else throw new TypeError("Missing internal model.");t.textures=yield Promise.all(n),t.emit("textureLoaded",t.textures)}else throw new TypeError("Missing settings.")}),createInternalModel=(r,e)=>__async$2(void 0,null,function*(){const t=r.settings;if(t instanceof ModelSettings){const n=Live2DFactory.findRuntime(t);if(!n)throw new TypeError("Unknown model settings.");const i=yield Live2DLoader.load({settings:t,url:t.moc,type:"arraybuffer",target:r.live2dModel});if(!n.isValidMoc(i))throw new Error("Invalid moc data");const a=n.createCoreModel(i);return r.internalModel=n.createInternalModel(a,t,r.options),e()}throw new TypeError("Missing settings.")}),_Live2DFactory=class{static registerRuntime(r){_Live2DFactory.runtimes.push(r),_Live2DFactory.runtimes.sort((e,t)=>t.version-e.version)}static findRuntime(r){for(const e of _Live2DFactory.runtimes)if(e.test(r))return e}static setupLive2DModel(r,e,t){return __async$2(this,null,function*(){const n=new Promise(l=>r.once("textureLoaded",l)),i=new Promise(l=>r.once("modelLoaded",l)),a=Promise.all([n,i]).then(()=>r.emit("ready"));yield runMiddlewares(_Live2DFactory.live2DModelMiddlewares,{live2dModel:r,source:e,options:t||{}}),yield a,r.emit("load")})}static loadMotion(r,e,t){var n,i;const a=l=>r.emit("motionLoadError",e,t,l);try{const l=(n=r.definitions[e])==null?void 0:n[t];if(!l)return Promise.resolve(void 0);r.listeners("destroy").includes(_Live2DFactory.releaseTasks)||r.once("destroy",_Live2DFactory.releaseTasks);let u=_Live2DFactory.motionTasksMap.get(r);u||(u={},_Live2DFactory.motionTasksMap.set(r,u));let d=u[e];d||(d=[],u[e]=d);const f=r.getMotionFile(l);return(i=d[t])!=null||(d[t]=Live2DLoader.load({url:f,settings:r.settings,type:r.motionDataType,target:r}).then(m=>{var s;const o=(s=_Live2DFactory.motionTasksMap.get(r))==null?void 0:s[e];o&&delete o[t];const c=r.createMotion(m,e,l);return r.emit("motionLoaded",e,t,c),c}).catch(m=>{logger.warn(r.tag,`Failed to load motion: ${f} -`,m),a(m)})),d[t]}catch(l){logger.warn(r.tag,`Failed to load motion at "${e}"[${t}] -`,l),a(l)}return Promise.resolve(void 0)}static loadExpression(r,e){var t;const n=i=>r.emit("expressionLoadError",e,i);try{const i=r.definitions[e];if(!i)return Promise.resolve(void 0);r.listeners("destroy").includes(_Live2DFactory.releaseTasks)||r.once("destroy",_Live2DFactory.releaseTasks);let a=_Live2DFactory.expressionTasksMap.get(r);a||(a=[],_Live2DFactory.expressionTasksMap.set(r,a));const l=r.getExpressionFile(i);return(t=a[e])!=null||(a[e]=Live2DLoader.load({url:l,settings:r.settings,type:"json",target:r}).then(u=>{const d=_Live2DFactory.expressionTasksMap.get(r);d&&delete d[e];const f=r.createExpression(u,i);return r.emit("expressionLoaded",e,f),f}).catch(u=>{logger.warn(r.tag,`Failed to load expression: ${l} -`,u),n(u)})),a[e]}catch(i){logger.warn(r.tag,`Failed to load expression at [${e}] -`,i),n(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof MotionManager?_Live2DFactory.motionTasksMap.delete(this):_Live2DFactory.expressionTasksMap.delete(this)}};let Live2DFactory=_Live2DFactory;Live2DFactory.runtimes=[];Live2DFactory.urlToJSON=urlToJSON;Live2DFactory.jsonToSettings=jsonToSettings;Live2DFactory.waitUntilReady=waitUntilReady;Live2DFactory.setupOptionals=setupOptionals;Live2DFactory.setupEssentials=setupEssentials;Live2DFactory.createInternalModel=createInternalModel;Live2DFactory.live2DModelMiddlewares=[urlToJSON,jsonToSettings,waitUntilReady,setupOptionals,setupEssentials,createInternalModel];Live2DFactory.motionTasksMap=new WeakMap;Live2DFactory.expressionTasksMap=new WeakMap;MotionManager.prototype._loadMotion=function(r,e){return Live2DFactory.loadMotion(this,r,e)};ExpressionManager.prototype._loadExpression=function(r){return Live2DFactory.loadExpression(this,r)};class InteractionMixin{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(e){e!==this._autoInteract&&(e?this.on("pointertap",onTap,this):this.off("pointertap",onTap,this),this._autoInteract=e)}registerInteraction(e){e!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&e&&(this.interactionManager=e,e.on("pointermove",onPointerMove,this)))}unregisterInteraction(){var e;this.interactionManager&&((e=this.interactionManager)==null||e.off("pointermove",onPointerMove,this),this.interactionManager=void 0)}}function onTap(r){this.tap(r.data.global.x,r.data.global.y)}function onPointerMove(r){this.focus(r.data.global.x,r.data.global.y)}class Live2DTransform extends Transform{}const tempPoint=new Point,tempMatrix$1=new Matrix;let tickerRef;class Live2DModel extends Container{constructor(e){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new Live2DTransform,this.anchor=new ObservablePoint(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(e))}static from(e,t){const n=new this(t);return Live2DFactory.setupLive2DModel(n,e,t).then(()=>n)}static fromSync(e,t){const n=new this(t);return Live2DFactory.setupLive2DModel(n,e,t).then(t==null?void 0:t.onLoad).catch(t==null?void 0:t.onError),n}static registerTicker(e){tickerRef=e}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){var t;tickerRef||(tickerRef=(t=window.PIXI)==null?void 0:t.Ticker),e?this._destroyed||(tickerRef?(tickerRef.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):logger.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(tickerRef==null||tickerRef.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(e){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const t=Object.assign({autoUpdate:!0,autoInteract:!0},e);t.autoInteract&&(this.interactive=!0),this.autoInteract=t.autoInteract,this.autoUpdate=t.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(e,t,n){return t===void 0?this.internalModel.motionManager.startRandomMotion(e,n):this.internalModel.motionManager.startMotion(e,t,n)}expression(e){return this.internalModel.motionManager.expressionManager?e===void 0?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(e):Promise.resolve(!1)}focus(e,t,n=!1){tempPoint.x=e,tempPoint.y=t,this.toModelPosition(tempPoint,tempPoint,!0);let i=tempPoint.x/this.internalModel.originalWidth*2-1,a=tempPoint.y/this.internalModel.originalHeight*2-1,l=Math.atan2(a,i);this.internalModel.focusController.focus(Math.cos(l),-Math.sin(l),n)}tap(e,t){const n=this.hitTest(e,t);n.length&&(logger.log(this.tag,"Hit",n),this.emit("hit",n))}hitTest(e,t){return tempPoint.x=e,tempPoint.y=t,this.toModelPosition(tempPoint,tempPoint),this.internalModel.hitTest(tempPoint.x,tempPoint.y)}toModelPosition(e,t=e.clone(),n){return n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(e,t),this.internalModel.localTransform.applyInverse(t,t),t}containsPoint(e){return this.getBounds(!0).contains(e.x,e.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(tickerRef.shared.deltaMS)}update(e){this.deltaTime+=e,this.elapsedTime+=e}_render(e){this.registerInteraction(e.plugins.interaction),e.batch.reset(),e.geometry.reset(),e.shader.reset(),e.state.reset();let t=!1;this.glContextID!==e.CONTEXT_UID&&(this.glContextID=e.CONTEXT_UID,this.internalModel.updateWebGLContext(e.gl,this.glContextID),t=!0);for(let a=0;at.destroy(e.baseTexture)),this.internalModel.destroy(),super.destroy(e)}}applyMixins(Live2DModel,[InteractionMixin]);const _FileLoader=class{static resolveURL(r,e){var t;const n=(t=_FileLoader.filesMap[r])==null?void 0:t[e];if(n===void 0)throw new Error("Cannot find this file from uploaded files: "+e);return n}static upload(r,e){return __async$2(this,null,function*(){const t={};for(const n of e.getDefinedFiles()){const i=decodeURI(url.resolve(e.url,n)),a=r.find(l=>l.webkitRelativePath===i);a&&(t[n]=URL.createObjectURL(a))}_FileLoader.filesMap[e._objectURL]=t})}static createSettings(r){return __async$2(this,null,function*(){const e=r.find(l=>l.name.endsWith("model.json")||l.name.endsWith("model3.json"));if(!e)throw new TypeError("Settings file not found");const t=yield _FileLoader.readText(e),n=JSON.parse(t);n.url=e.webkitRelativePath;const i=Live2DFactory.findRuntime(n);if(!i)throw new Error("Unknown settings JSON");const a=i.createModelSettings(n);return a._objectURL=URL.createObjectURL(e),a})}static readText(r){return __async$2(this,null,function*(){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsText(r,"utf8")})})}};let FileLoader=_FileLoader;FileLoader.filesMap={};FileLoader.factory=(r,e)=>__async$2(void 0,null,function*(){if(Array.isArray(r.source)&&r.source[0]instanceof File){const t=r.source;let n=t.settings;if(!n)n=yield _FileLoader.createSettings(t);else if(!n._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');n.validateFiles(t.map(i=>encodeURI(i.webkitRelativePath))),yield _FileLoader.upload(t,n),n.resolveURL=function(i){return _FileLoader.resolveURL(this._objectURL,i)},r.source=n,r.live2dModel.once("modelLoaded",i=>{i.once("destroy",function(){const a=this.settings._objectURL;if(URL.revokeObjectURL(a),_FileLoader.filesMap[a])for(const l of Object.values(_FileLoader.filesMap[a]))URL.revokeObjectURL(l);delete _FileLoader.filesMap[a]})})}return e()});Live2DFactory.live2DModelMiddlewares.unshift(FileLoader.factory);const _ZipLoader=class{static unzip(r,e){return __async$2(this,null,function*(){const t=yield _ZipLoader.getFilePaths(r),n=[];for(const a of e.getDefinedFiles()){const l=decodeURI(url.resolve(e.url,a));t.includes(l)&&n.push(l)}const i=yield _ZipLoader.getFiles(r,n);for(let a=0;al.endsWith("model.json")||l.endsWith("model3.json"));if(!t)throw new Error("Settings file not found");const n=yield _ZipLoader.readText(r,t);if(!n)throw new Error("Empty settings file: "+t);const i=JSON.parse(n);i.url=t;const a=Live2DFactory.findRuntime(i);if(!a)throw new Error("Unknown settings JSON");return a.createModelSettings(i)})}static zipReader(r,e){return __async$2(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(r){return __async$2(this,null,function*(){throw new Error("Not implemented")})}static getFiles(r,e){return __async$2(this,null,function*(){throw new Error("Not implemented")})}static readText(r,e){return __async$2(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(r){}};let ZipLoader=_ZipLoader;ZipLoader.ZIP_PROTOCOL="zip://";ZipLoader.uid=0;ZipLoader.factory=(r,e)=>__async$2(void 0,null,function*(){const t=r.source;let n,i,a;if(typeof t=="string"&&(t.endsWith(".zip")||t.startsWith(_ZipLoader.ZIP_PROTOCOL))?(t.startsWith(_ZipLoader.ZIP_PROTOCOL)?n=t.slice(_ZipLoader.ZIP_PROTOCOL.length):n=t,i=yield Live2DLoader.load({url:n,type:"blob",target:r.live2dModel})):Array.isArray(t)&&t.length===1&&t[0]instanceof File&&t[0].name.endsWith(".zip")&&(i=t[0],n=URL.createObjectURL(i),a=t.settings),i){if(!i.size)throw new Error("Empty zip file");const l=yield _ZipLoader.zipReader(i,n);a||(a=yield _ZipLoader.createSettings(l)),a._objectURL=_ZipLoader.ZIP_PROTOCOL+_ZipLoader.uid+"/"+a.url;const u=yield _ZipLoader.unzip(l,a);u.settings=a,r.source=u,n.startsWith("blob:")&&r.live2dModel.once("modelLoaded",d=>{d.once("destroy",function(){URL.revokeObjectURL(n)})}),_ZipLoader.releaseReader(l)}return e()});Live2DFactory.live2DModelMiddlewares.unshift(ZipLoader.factory);if(!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class Cubism4ExpressionManager extends ExpressionManager{constructor(e,t){var n;super(e,t),this.queueManager=new CubismMotionQueueManager,this.definitions=(n=e.expressions)!=null?n:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(e){return this.definitions.findIndex(t=>t.Name===e)}getExpressionFile(e){return e.File}createExpression(e,t){return CubismExpressionMotion.create(e)}_setExpression(e){return this.queueManager.startMotion(e,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(e,t){return this.queueManager.doUpdateMotion(e,t)}}class Cubism4ModelSettings extends ModelSettings{constructor(e){if(super(e),!Cubism4ModelSettings.isValidJSON(e))throw new TypeError("Invalid JSON.");Object.assign(this,new CubismModelSettingsJson(e))}static isValidJSON(e){var t;return!!(e!=null&&e.FileReferences)&&typeof e.FileReferences.Moc=="string"&&((t=e.FileReferences.Textures)==null?void 0:t.length)>0&&e.FileReferences.Textures.every(n=>typeof n=="string")}replaceFiles(e){if(super.replaceFiles(e),this.motions)for(const[t,n]of Object.entries(this.motions))for(let i=0;i{this.emit("motion:"+n)})}isFinished(){return this.queueManager.isFinished()}_startMotion(e,t){return e.setFinishedMotionHandler(t),this.queueManager.stopAllMotions(),this.queueManager.startMotion(e,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(e,t,n){const i=CubismMotion.create(e),a=new CubismMotionJson(e),l=(t===this.groups.idle?config.idleMotionFadingDuration:config.motionFadingDuration)/1e3;return a.getMotionFadeInTime()===void 0&&i.setFadeInTime(n.FadeInTime>0?n.FadeInTime:l),a.getMotionFadeOutTime()===void 0&&i.setFadeOutTime(n.FadeOutTime>0?n.FadeOutTime:l),i.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),i}getMotionFile(e){return e.File}getMotionName(e){return e.File}getSoundFile(e){return e.Sound}updateParameters(e,t){return this.queueManager.doUpdateMotion(e,t)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const tempMatrix=new CubismMatrix44;class Cubism4InternalModel extends InternalModel{constructor(e,t,n){super(),this.lipSync=!0,this.breath=CubismBreath.create(),this.renderer=new CubismRenderer_WebGL,this.idParamAngleX=ParamAngleX,this.idParamAngleY=ParamAngleY,this.idParamAngleZ=ParamAngleZ,this.idParamEyeBallX=ParamEyeBallX,this.idParamEyeBallY=ParamEyeBallY,this.idParamBodyAngleX=ParamBodyAngleX,this.idParamBreath=ParamBreath,this.pixelsPerUnit=1,this.centeringTransform=new Matrix,this.coreModel=e,this.settings=t,this.motionManager=new Cubism4MotionManager(t,n),this.init()}init(){var e;super.init(),((e=this.settings.getEyeBlinkParameters())==null?void 0:e.length)>0&&(this.eyeBlink=CubismEyeBlink.create(this.settings)),this.breath.setParameters([new BreathParameterData(this.idParamAngleX,0,15,6.5345,.5),new BreathParameterData(this.idParamAngleY,0,8,3.5345,.5),new BreathParameterData(this.idParamAngleZ,0,10,5.5345,.5),new BreathParameterData(this.idParamBodyAngleX,0,4,15.5345,.5),new BreathParameterData(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const e={};if(this.settings.layout)for(const t of Object.keys(this.settings.layout)){const n=t.charAt(0).toLowerCase()+t.slice(1);e[n]=this.settings.layout[t]}return e}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(e,t){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(e),this.renderer._clippingManager._currentFrameNo=t,this.renderer._clippingManager._maskTexture=void 0,CubismShader_WebGL.getInstance()._shaderSets=[]}bindTexture(e,t){this.renderer.bindTexture(e,t)}getHitAreaDefs(){var e,t;return(t=(e=this.settings.hitAreas)==null?void 0:e.map(n=>({id:n.Id,name:n.Name,index:this.coreModel.getDrawableIndex(n.Id)})))!=null?t:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(e){return this.coreModel.getDrawableIndex(e)}getDrawableVertices(e){if(typeof e=="string"&&(e=this.coreModel.getDrawableIndex(e),e===-1))throw new TypeError("Unable to find drawable ID: "+e);const t=this.coreModel.getDrawableVertices(e).slice();for(let n=0;n{function t(){try{startUpCubism4(),r()}catch(n){if(startupRetries--,startupRetries<0){const i=new Error("Failed to start up Cubism 4 framework.");i.cause=n,e(i);return}logger.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(t,10)}}t()})),startupPromise)}function startUpCubism4(r){r=Object.assign({logFunction:console.log,loggingLevel:LogLevel.LogLevel_Verbose},r),CubismFramework.startUp(r),CubismFramework.initialize()}Live2DFactory.registerRuntime({version:4,ready:cubism4Ready,test(r){return r instanceof Cubism4ModelSettings||Cubism4ModelSettings.isValidJSON(r)},isValidMoc(r){if(r.byteLength<4)return!1;const e=new Int8Array(r,0,4);return String.fromCharCode(...e)==="MOC3"},createModelSettings(r){return new Cubism4ModelSettings(r)},createCoreModel(r){const e=CubismMoc.create(r);try{const t=e.createModel();return t.__moc=e,t}catch(t){try{e.release()}catch{}throw t}},createInternalModel(r,e,t){const n=new Cubism4InternalModel(r,e,t),i=r;return i.__moc&&(n.__moc=i.__moc,delete i.__moc,n.once("destroy",releaseMoc)),n},createPhysics(r,e){return CubismPhysics.create(e)},createPose(r,e){return CubismPose.create(e)}});function releaseMoc(){var r;(r=this.__moc)==null||r.release()}const _sfc_main$8=defineComponent({__name:"Viewer",props:{model:null,mouthOpenSize:{default:0}},setup(r,{expose:e}){const t=r,n=ref$1(),i=ref$1(),a=ref$1(),l=ref$1(),u=ref$1(0),d=ref$1(0),f=computed(()=>Math.max(0,Math.min(100,t.mouthOpenSize))),m=useDark(),s=useBreakpoints(breakpointsTailwind),o=computed(()=>s.between("sm","md").value||s.smaller("sm").value),{height:c,width:v}=useElementBounding(n,{immediate:!0,windowResize:!0,reset:!0});function y(){return l.value.internalModel.coreModel}function _(T){if(!T.value)return;let E=2.2;o.value&&(E=2.2);const M=c.value*.95/d.value*E,P=v.value*.95/u.value*E,A=Math.min(M,P);T.value.scale.set(A,A)}async function b(T){Live2DModel.registerTicker(Ticker),extensions.add(TickerPlugin),i.value=new Application({width:v.value,height:c.value,backgroundAlpha:0}),a.value=i.value.view,a.value.style.objectFit="contain",T.appendChild(i.value.view),l.value=await Live2DModel.from(t.model,{motionPreload:MotionPreloadStrategy.ALL}),i.value.stage.addChild(l.value),u.value=l.value.width,d.value=l.value.height,l.value.x=v.value/2,l.value.y=c.value,l.value.rotation=Math.PI,l.value.skew.x=Math.PI,l.value.anchor.set(.5,.5),_(l),l.value.on("hit",M=>{l.value&&M.includes("body")&&l.value.motion("tap_body")}),l.value.internalModel.coreModel.setParameterValueById("ParamMouthOpenY",f.value)}async function x(T){await l.value.motion(T,void 0,MotionPriority.FORCE)}const w=useDebounceFn(()=>{i.value&&i.value.renderer.resize(v.value,c.value),a.value&&(a.value.width=v.value,a.value.height=c.value),l.value&&(l.value.x=v.value/2,l.value.y=c.value,_(l))},100);function S(){l.value&&(l.value.filters=[new DropShadowFilter({color:m.value?10053247:14662098,alpha:.3,blur:0,distance:20,rotation:45})])}return watch([v,c],()=>{w()}),watch(m,S,{immediate:!0}),watch(l,S),onMounted(S),onMounted(async()=>{n.value&&await b(n.value)}),onUnmounted(()=>{var T;(T=i.value)==null||T.destroy()}),watch(f,T=>{y().setParameterValueById("ParamMouthOpenY",T)}),e({setMotion:x}),(T,E)=>(openBlock(),createElementBlock("div",{ref_key:"containerRef",ref:n,"h-full":"","w-full":""},null,512))}}),_sfc_main$7=defineComponent({__name:"Screen",setup(r){const e=ref$1(),t=useBreakpoints(breakpointsTailwind),{width:n,height:i}=useWindowSize(),a=useElementBounding(e,{immediate:!0,windowResize:!0,reset:!0}),l=computed(()=>t.between("sm","md").value||t.smaller("sm").value),u=computed(()=>t.between("md","lg").value),d=computed(()=>t.greaterOrEqual("lg").value),f=computed(()=>d.value?a.width.value:l.value||u.value?n.value-16:a.width.value),m=ref$1(0);return watch([n,i,e],()=>{var o,c;const s=(c=(o=e.value)==null?void 0:o.parentElement)==null?void 0:c.getBoundingClientRect();d.value||l.value||u.value?m.value=(s==null?void 0:s.height)||0:m.value=600}),watch([a.width,a.height],()=>{d.value||l.value||u.value?m.value=a.height.value:m.value=600}),onMounted(async()=>{e.value&&a.update()}),(s,o)=>(openBlock(),createElementBlock("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[renderSlot(s.$slots,"default",{width:f.value,height:m.value})],512))}}),_hoisted_1$4={absolute:"",bottom:"2",right:"2"},_hoisted_2$4={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":""},_hoisted_3$3=["checked","aria-checked"],_hoisted_4$2={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var a;await((a=t.value)==null?void 0:a.setMotion(i))}}),(i,a)=>{const l=_sfc_main$h;return openBlock(),createBlock(_sfc_main$7,{relative:""},{default:withCtx(({width:u,height:d})=>[createVNode(_sfc_main$8,{ref_key:"modelRef",ref:t,"canvas-width":u,"canvas-height":d,model:r.model,"mouth-open-size":r.mouthOpenSize},null,8,["canvas-width","canvas-height","model","mouth-open-size"]),createBaseVNode("div",_hoisted_1$4,[createBaseVNode("div",_hoisted_2$4,[createBaseVNode("label",{"h-fit":"","cursor-pointer":"",class:normalizeClass([n.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":"",z:"n.value=f),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_3$3),[[vModelCheckbox,n.value]]),a[8]||(a[8]=createBaseVNode("div",{"select-none":""},[createBaseVNode("div",{"i-solar:bug-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800"})],-1))],2)]),createVNode(l,null,{default:withCtx(()=>[n.value?(openBlock(),createElementBlock("div",_hoisted_4$2,[createBaseVNode("div",_hoisted_5$2,[a[9]||(a[9]=createBaseVNode("div",{"font-mono":""},[createBaseVNode("span",null,"Emotions")],-1)),createBaseVNode("div",_hoisted_6$1,[createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[1]||(a[1]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionSurpriseMotionName))})}," 🤯 Surprised "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[2]||(a[2]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionSadMotionName))})}," 😫 Sad "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[3]||(a[3]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionAngryMotionName))})}," 😠 Angry "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[4]||(a[4]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionHappyMotionName))})}," 😄 Happy "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[5]||(a[5]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionAwkwardMotionName))})}," 😳 Awkward "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[6]||(a[6]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionQuestionMotionName))})}," 🤔 Question "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:a[7]||(a[7]=f=>{var m;return(m=t.value)==null?void 0:m.setMotion(unref(EmotionThinkMotionName))})}," 🤨 Think ")])])])):createCommentVNode("",!0)]),_:1})])]),_:1})}}});function Rr(r){return getCurrentScope()?(onScopeDispose(r),!0):!1}function lt(r){return typeof r=="function"?r():unref(r)}const Uc=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const zc=Object.prototype.toString,Hc=r=>zc.call(r)==="[object Object]",An=()=>{};function bn(r){var e;const t=lt(r);return(e=t==null?void 0:t.$el)!=null?e:t}const on=Uc?window:void 0;function He(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=on):[e,t,n,i]=r,!e)return An;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const a=[],l=()=>{a.forEach(m=>m()),a.length=0},u=(m,s,o,c)=>(m.addEventListener(s,o,c),()=>m.removeEventListener(s,o,c)),d=watch(()=>[bn(e),lt(i)],([m,s])=>{if(l(),!m)return;const o=Hc(s)?{...s}:s;a.push(...t.flatMap(c=>n.map(v=>u(m,c,v,o))))},{immediate:!0,flush:"post"}),f=()=>{d(),l()};return Rr(f),f}class Ms extends Mesh{constructor(){super(Ms.Geometry,new MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new Vector3,t=new Vector3,n=new FramebufferTexture(16,16),i=new FramebufferTexture(16,16);let a=UnsignedByteType;const l=Ms.Geometry,u=new RawShaderMaterial({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}),d=new RawShaderMaterial({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}),f=new Mesh(l,u),m=[],s=Da.Shader,o=new RawShaderMaterial({name:s.name,uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new Color(16777215)},scale:{value:new Vector2},screenPosition:{value:new Vector3}},vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:AdditiveBlending,transparent:!0,depthWrite:!1}),c=new Mesh(l,o);this.addElement=function(x){m.push(x)};const v=new Vector2,y=new Vector2,_=new Box2,b=new Vector4;this.onBeforeRender=function(x,w,S){x.getCurrentViewport(b);const T=x.getRenderTarget(),E=T!==null?T.texture.type:UnsignedByteType;a!==E&&(n.dispose(),i.dispose(),n.type=i.type=E,a=E);const M=b.w/b.z,P=b.z/2,A=b.w/2;let C=16/b.w;if(v.set(C*M,C),_.min.set(b.x,b.y),_.max.set(b.x+(b.z-16),b.y+(b.w-16)),t.setFromMatrixPosition(this.matrixWorld),t.applyMatrix4(S.matrixWorldInverse),!(t.z>0)&&(e.copy(t).applyMatrix4(S.projectionMatrix),y.x=b.x+e.x*P+P-8,y.y=b.y+e.y*A+A-8,_.containsPoint(y))){x.copyFramebufferToTexture(n,y);let D=u.uniforms;D.scale.value=v,D.screenPosition.value=e,x.renderBufferDirect(S,null,l,u,f,null),x.copyFramebufferToTexture(i,y),D=d.uniforms,D.scale.value=v,D.screenPosition.value=e,x.renderBufferDirect(S,null,l,d,f,null);const k=-e.x*2,j=-e.y*2;for(let I=0,W=m.length;Ie in r?Su(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Pu=(r,e,t)=>(Au(r,e+"",t),t);async function no(r){const e=await r.arrayBuffer(),t=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${r.type||""};base64,${t}`}let Gs,Ei,zn,js;function Mi(r,e=1/0,t=null){Ei||(Ei=new PlaneGeometry(2,2,1,1)),zn||(zn=new ShaderMaterial({uniforms:{blitTexture:new Uniform(r)},vertexShader:` - varying vec2 vUv; - void main(){ - vUv = uv; - gl_Position = vec4(position.xy * 1.0,0.,.999999); - } - `,fragmentShader:` - uniform sampler2D blitTexture; - varying vec2 vUv; - - void main(){ - gl_FragColor = vec4(vUv.xy, 0, 1); - - #ifdef IS_SRGB - gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); - #else - gl_FragColor = texture2D( blitTexture, vUv); - #endif - } - `})),zn.uniforms.blitTexture.value=r,zn.defines.IS_SRGB="colorSpace"in r?r.colorSpace==="srgb":r.encoding===3001,zn.needsUpdate=!0,js||(js=new Mesh(Ei,zn),js.frustrumCulled=!1);const n=new PerspectiveCamera,i=new Scene;i.add(js),t||(t=Gs=new WebGLRenderer({antialias:!1})),t.setSize(Math.min(r.image.width,e),Math.min(r.image.height,e)),t.clear(),t.render(i,n);const a=new Texture$1(t.domElement);return a.minFilter=r.minFilter,a.magFilter=r.magFilter,a.wrapS=r.wrapS,a.wrapT=r.wrapT,a.name=r.name,Gs&&(Gs.dispose(),Gs=null),a}const so={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 Lr{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Nu(e)}),this.register(function(e){return new Uu(e)}),this.register(function(e){return new Gu(e)}),this.register(function(e){return new ju(e)}),this.register(function(e){return new Vu(e)}),this.register(function(e){return new Yu(e)}),this.register(function(e){return new zu(e)}),this.register(function(e){return new Hu(e)}),this.register(function(e){return new Xu(e)}),this.register(function(e){return new Wu(e)}),this.register(function(e){return new $u(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){const a=new Bu,l=[];for(let u=0,d=this.pluginCallbacks.length;ur.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<.001)return r.times.length-1;n[n.length-1]=e,n.set(r.times,0),i.set(r.values,0),i.set(a.evaluate(e),r.values.length),l=n.length-1}else for(let u=0;ue){n.set(r.times.slice(0,u+1),0),n[u+1]=e,n.set(r.times.slice(u+1),u+2),i.set(r.values.slice(0,(u+1)*t),0),i.set(a.evaluate(e),(u+1)*t),i.set(r.values.slice((u+1)*t),(u+2)*t),l=u+1;break}}return r.times=n,r.values=i,l},mergeMorphTargetTracks:function(r,e){const t=[],n={},i=r.tracks;for(let a=0;a4?l=r.array[i*r.itemSize+a]:(a===0?l=r.getX(i):a===1?l=r.getY(i):a===2?l=r.getZ(i):a===3&&(l=r.getW(i)),r.normalized===!0&&(l=MathUtils.normalize(l,r.array))),n.min[a]=Math.min(n.min[a],l),n.max[a]=Math.max(n.max[a],l)}return n}function Na(r){return Math.ceil(r/4)*4}function Ai(r,e=0){const t=Na(r.byteLength);if(t!==r.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function lo(r,e){if(r.toBlob!==void 0)return new Promise(n=>r.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),r.convertToBlob({type:e,quality:t})}class Bu{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,a=i.buffers,l=i.json;n=i.options;const u=i.extensionsUsed,d=i.extensionsRequired,f=new Blob(a,{type:"application/octet-stream"}),m=Object.keys(u),s=Object.keys(d);m.length>0&&(l.extensionsUsed=m),s.length>0&&(l.extensionsRequired=s),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=f.size),n.binary===!0?f.arrayBuffer().then(o=>{const c=Ai(o),v=new DataView(new ArrayBuffer(oo));v.setUint32(0,c.byteLength,!0),v.setUint32(4,Du,!0);const y=Ai(Lu(JSON.stringify(l)),32),_=new DataView(new ArrayBuffer(oo));_.setUint32(0,y.byteLength,!0),_.setUint32(4,Ou,!0);const b=new ArrayBuffer(ro),x=new DataView(b);x.setUint32(0,Ru,!0),x.setUint32(4,Iu,!0);const w=ro+_.byteLength+y.byteLength+v.byteLength+c.byteLength;x.setUint32(8,w,!0),new Blob([b,_,y,v,c],{type:"application/octet-stream"}).arrayBuffer().then(t)}):l.buffers&&l.buffers.length>0?no(f).then(o=>{l.buffers[0].uri=o,t(l)}):t(l)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,i=this.extensionsUsed;try{const a=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&a.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const l in a.gltfExtensions)t.extensions[l]=a.gltfExtensions[l],i[l]=!0;delete a.gltfExtensions}Object.keys(a).length>0&&(t.extras=a)}catch(a){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+a.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const n=new Map;n.set(!0,this.uid++),n.set(!1,this.uid++),this.uids.set(e,n)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new Vector3;for(let n=0,i=e.count;n5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),i=new Vector3;for(let a=0,l=n.count;a4?v=e.array[o*e.itemSize+c]:(c===0?v=e.getX(o):c===1?v=e.getY(o):c===2?v=e.getZ(o):c===3&&(v=e.getW(o)),e.normalized===!0&&(v=MathUtils.normalize(v,e.array))),t===Oe.FLOAT?f.setFloat32(m,v,!0):t===Oe.INT?f.setInt32(m,v,!0):t===Oe.UNSIGNED_INT?f.setUint32(m,v,!0):t===Oe.SHORT?f.setInt16(m,v,!0):t===Oe.UNSIGNED_SHORT?f.setUint16(m,v,!0):t===Oe.BYTE?f.setInt8(m,v):t===Oe.UNSIGNED_BYTE&&f.setUint8(m,v),m+=u}const s={buffer:this.processBuffer(f.buffer),byteOffset:this.byteOffset,byteLength:d};return a!==void 0&&(s.target=a),a===Oe.ARRAY_BUFFER&&(s.byteStride=e.itemSize*u),this.byteOffset+=d,l.bufferViews.push(s),{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),e.arrayBuffer().then(i=>{const a=Ai(i),l={buffer:t.processBuffer(a),byteOffset:t.byteOffset,byteLength:a.byteLength};return t.byteOffset+=a.byteLength,n.bufferViews.push(l)-1})}processAccessor(e,t,n,i){const a=this.json,l={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let u;if(e.array.constructor===Float32Array)u=Oe.FLOAT;else if(e.array.constructor===Int32Array)u=Oe.INT;else if(e.array.constructor===Uint32Array)u=Oe.UNSIGNED_INT;else if(e.array.constructor===Int16Array)u=Oe.SHORT;else if(e.array.constructor===Uint16Array)u=Oe.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)u=Oe.BYTE;else if(e.array.constructor===Uint8Array)u=Oe.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),i===void 0&&(i=e.count),i===0)return null;const d=ku(e,n,i);let f;t!==void 0&&(f=e===t.index?Oe.ELEMENT_ARRAY_BUFFER:Oe.ARRAY_BUFFER);const m=this.processBufferView(e,u,n,i,f),s={bufferView:m.id,byteOffset:m.byteOffset,componentType:u,count:i,max:d.max,min:d.min,type:l[e.itemSize]};return e.normalized===!0&&(s.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(s)-1}processImage(e,t,n,i="image/png"){if(e!==null){const a=this,l=a.cache,u=a.json,d=a.options,f=a.pending;l.images.has(e)||l.images.set(e,{});const m=l.images.get(e),s=i+":flipY/"+n.toString();if(m[s]!==void 0)return m[s];u.images||(u.images=[]);const o={mimeType:i},c=ao();c.width=Math.min(e.width,d.maxTextureSize),c.height=Math.min(e.height,d.maxTextureSize);const v=c.getContext("2d");if(n===!0&&(v.translate(0,c.height),v.scale(1,-1)),e.data!==void 0){t!==RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>d.maxTextureSize||e.height>d.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const _=new Uint8ClampedArray(e.height*e.width*4);for(let b=0;b<_.length;b+=4)_[b+0]=e.data[b+0],_[b+1]=e.data[b+1],_[b+2]=e.data[b+2],_[b+3]=e.data[b+3];v.putImageData(new ImageData(_,e.width,e.height),0,0)}else v.drawImage(e,0,0,c.width,c.height);d.binary===!0?f.push(lo(c,i).then(_=>a.processBufferViewImage(_)).then(_=>{o.bufferView=_})):c.toDataURL!==void 0?o.uri=c.toDataURL(i):f.push(lo(c,i).then(no).then(_=>{o.uri=_}));const y=u.images.push(o)-1;return m[s]=y,y}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:_t[e.magFilter],minFilter:_t[e.minFilter],wrapS:_t[e.wrapS],wrapT:_t[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const t=this.options,n=this.cache,i=this.json;if(n.textures.has(e))return n.textures.get(e);i.textures||(i.textures=[]),e instanceof CompressedTexture&&(e=Mi(e,t.maxTextureSize));let a=e.userData.mimeType;a==="image/webp"&&(a="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)};e.name&&(l.name=e.name),this._invokeAll(function(d){d.writeTexture&&d.writeTexture(e,l)});const u=i.textures.push(l)-1;return n.textures.set(e,u),u}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const a=e.color.toArray().concat([e.opacity]);if(vs(a,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=a),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 u=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),d={index:this.processTexture(u),channel:u.channel};this.applyTextureTransform(d,u),i.pbrMetallicRoughness.metallicRoughnessTexture=d}if(e.map){const u={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(u,e.map),i.pbrMetallicRoughness.baseColorTexture=u}if(e.emissive){const u=e.emissive;if(Math.max(u.r,u.g,u.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const d={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(d,e.emissiveMap),i.emissiveTexture=d}}if(e.normalMap){const u={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(u.scale=e.normalScale.x),this.applyTextureTransform(u,e.normalMap),i.normalTexture=u}if(e.aoMap){const u={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(u.strength=e.aoMapIntensity),this.applyTextureTransform(u,e.aoMap),i.occlusionTexture=u}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===DoubleSide&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(u){u.writeMaterial&&u.writeMaterial(e,i)});const l=n.materials.push(i)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let w=0,S=e.material.length;w=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"},c=l.getAttribute("normal");c!==void 0&&!this.isNormalizedNormalAttribute(c)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(c)));let v=null;for(let w in l.attributes){if(w.slice(0,5)==="morph")continue;const S=l.attributes[w];if(w=o[w]||w.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(w)||(w="_"+w),t.attributes.has(this.getUID(S))){f[w]=t.attributes.get(this.getUID(S));continue}v=null;const T=S.array;w==="JOINTS_0"&&!(T instanceof Uint16Array)&&!(T instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),v=new BufferAttribute(new Uint16Array(T),S.itemSize,S.normalized));const E=this.processAccessor(v||S,l);E!==null&&(w.startsWith("_")||this.detectMeshQuantization(w,S),f[w]=E,t.attributes.set(this.getUID(S),E))}if(c!==void 0&&l.setAttribute("normal",c),Object.keys(f).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const w=[],S=[],T={};if(e.morphTargetDictionary!==void 0)for(const E in e.morphTargetDictionary)T[e.morphTargetDictionary[E]]=E;for(let E=0;E0&&(d.extras={},d.extras.targetNames=S)}const y=Array.isArray(e.material);if(y&&l.groups.length===0)return null;const _=y?e.material:[e.material],b=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let w=0,S=b.length;w0&&(T.targets=s),l.index!==null){let M=this.getUID(l.index);(b[w].start!==void 0||b[w].count!==void 0)&&(M+=":"+b[w].start+":"+b[w].count),t.attributes.has(M)?T.indices=t.attributes.get(M):(T.indices=this.processAccessor(l.index,l,b[w].start,b[w].count),t.attributes.set(M,T.indices)),T.indices===null&&delete T.indices}const E=this.processMaterial(_[b[w].materialIndex]);E!==null&&(T.material=E),m.push(T)}d.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll(function(w){w.writeMesh&&w.writeMesh(e,d)});const x=n.meshes.push(d)-1;return t.meshes.set(a,x),x}detectMeshQuantization(e,t){if(this.extensionsUsed[Si])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const i=e.split("_",1)[0];so[i]&&so[i].includes(n)&&(this.extensionsUsed[Si]=!0,this.extensionsRequired[Si]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=Lr.Utils.mergeMorphTargetTracks(e.clone(),t);const a=e.tracks,l=[],u=[];for(let d=0;d0){const u=[];for(let d=0,f=e.children.length;d0&&(a.children=u)}this._invokeAll(function(u){u.writeNode&&u.writeNode(e,a)});const l=t.nodes.push(a)-1;return i.set(e,l),l}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const a=[];for(let l=0,u=e.children.length;l0&&(i.nodes=a),this.serializeUserData(e,i)}processObjects(e){const t=new Scene;t.name="AuxScene";for(let n=0;n0&&this.processObjects(n);for(let i=0;i0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,l.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."),a[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},a[this.name]=!0);const u=i.extensions[this.name].lights;u.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:u.length-1}}}let Uu=class{constructor(r){this.writer=r,this.name="KHR_materials_unlit"}writeMaterial(r,e){if(!r.isMeshBasicMaterial)return;const t=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},t[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},zu=class{constructor(r){this.writer=r,this.name="KHR_materials_clearcoat"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.clearcoat===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.clearcoatFactor=r.clearcoat,r.clearcoatMap){const a={index:t.processTexture(r.clearcoatMap),texCoord:r.clearcoatMap.channel};t.applyTextureTransform(a,r.clearcoatMap),i.clearcoatTexture=a}if(i.clearcoatRoughnessFactor=r.clearcoatRoughness,r.clearcoatRoughnessMap){const a={index:t.processTexture(r.clearcoatRoughnessMap),texCoord:r.clearcoatRoughnessMap.channel};t.applyTextureTransform(a,r.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a}if(r.clearcoatNormalMap){const a={index:t.processTexture(r.clearcoatNormalMap),texCoord:r.clearcoatNormalMap.channel};t.applyTextureTransform(a,r.clearcoatNormalMap),i.clearcoatNormalTexture=a}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Hu=class{constructor(r){this.writer=r,this.name="KHR_materials_iridescence"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.iridescence===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.iridescenceFactor=r.iridescence,r.iridescenceMap){const a={index:t.processTexture(r.iridescenceMap),texCoord:r.iridescenceMap.channel};t.applyTextureTransform(a,r.iridescenceMap),i.iridescenceTexture=a}if(i.iridescenceIor=r.iridescenceIOR,i.iridescenceThicknessMinimum=r.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=r.iridescenceThicknessRange[1],r.iridescenceThicknessMap){const a={index:t.processTexture(r.iridescenceThicknessMap),texCoord:r.iridescenceThicknessMap.channel};t.applyTextureTransform(a,r.iridescenceThicknessMap),i.iridescenceThicknessTexture=a}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Gu=class{constructor(r){this.writer=r,this.name="KHR_materials_transmission"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.transmission===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.transmissionFactor=r.transmission,r.transmissionMap){const a={index:t.processTexture(r.transmissionMap),texCoord:r.transmissionMap.channel};t.applyTextureTransform(a,r.transmissionMap),i.transmissionTexture=a}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},ju=class{constructor(r){this.writer=r,this.name="KHR_materials_volume"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.transmission===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.thicknessFactor=r.thickness,r.thicknessMap){const a={index:t.processTexture(r.thicknessMap),texCoord:r.thicknessMap.channel};t.applyTextureTransform(a,r.thicknessMap),i.thicknessTexture=a}i.attenuationDistance=r.attenuationDistance,i.attenuationColor=r.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Vu=class{constructor(r){this.writer=r,this.name="KHR_materials_ior"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.ior===1.5)return;const t=this.writer.extensionsUsed,n={};n.ior=r.ior,e.extensions=e.extensions||{},e.extensions[this.name]=n,t[this.name]=!0}},Yu=class{constructor(r){this.writer=r,this.name="KHR_materials_specular"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.specularIntensity===1&&r.specularColor.equals(Cu)&&!r.specularIntensityMap&&!r.specularColorTexture)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.specularIntensityMap){const a={index:t.processTexture(r.specularIntensityMap),texCoord:r.specularIntensityMap.channel};t.applyTextureTransform(a,r.specularIntensityMap),i.specularTexture=a}if(r.specularColorMap){const a={index:t.processTexture(r.specularColorMap),texCoord:r.specularColorMap.channel};t.applyTextureTransform(a,r.specularColorMap),i.specularColorTexture=a}i.specularFactor=r.specularIntensity,i.specularColorFactor=r.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Xu=class{constructor(r){this.writer=r,this.name="KHR_materials_sheen"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.sheen==0)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.sheenRoughnessMap){const a={index:t.processTexture(r.sheenRoughnessMap),texCoord:r.sheenRoughnessMap.channel};t.applyTextureTransform(a,r.sheenRoughnessMap),i.sheenRoughnessTexture=a}if(r.sheenColorMap){const a={index:t.processTexture(r.sheenColorMap),texCoord:r.sheenColorMap.channel};t.applyTextureTransform(a,r.sheenColorMap),i.sheenColorTexture=a}i.sheenRoughnessFactor=r.sheenRoughness,i.sheenColorFactor=r.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Wu=class{constructor(r){this.writer=r,this.name="KHR_materials_anisotropy"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.anisotropy==0)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.anisotropyMap){const a={index:t.processTexture(r.anisotropyMap)};t.applyTextureTransform(a,r.anisotropyMap),i.anisotropyTexture=a}i.anisotropyStrength=r.anisotropy,i.anisotropyRotation=r.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},$u=class{constructor(r){this.writer=r,this.name="KHR_materials_emissive_strength"}writeMaterial(r,e){if(!r.isMeshStandardMaterial||r.emissiveIntensity===1)return;const t=this.writer.extensionsUsed,n={};n.emissiveStrength=r.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=n,t[this.name]=!0}};var St=Uint8Array,En=Uint16Array,fr=Uint32Array,Ua=new St([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]),za=new St([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]),Ha=function(r,e){for(var t=new En(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Ye&21845)<<1;fn=(fn&52428)>>>2|(fn&13107)<<2,fn=(fn&61680)>>>4|(fn&3855)<<4,dr[Ye]=((fn&65280)>>>8|(fn&255)<<8)>>>1}var Cs=new St(288);for(var Ye=0;Ye<144;++Ye)Cs[Ye]=8;for(var Ye=144;Ye<256;++Ye)Cs[Ye]=9;for(var Ye=256;Ye<280;++Ye)Cs[Ye]=7;for(var Ye=280;Ye<288;++Ye)Cs[Ye]=8;var Va=new St(32);for(var Ye=0;Ye<32;++Ye)Va[Ye]=5;var ih=new St(0),ah=typeof TextDecoder<"u"&&new TextDecoder,lh=0;try{ah.decode(ih,{stream:!0}),lh=1}catch{}var ch=Object.defineProperty,uh=(r,e,t)=>e in r?ch(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,hh=(r,e,t)=>(uh(r,e+"",t),t);const Ya=class extends Mesh{constructor(r,e={}){super(r),this.isReflector=!0,this.type="Reflector",this.camera=new PerspectiveCamera;const t=this,n=e.color!==void 0?new Color(e.color):new Color(8355711),i=e.textureWidth||512,a=e.textureHeight||512,l=e.clipBias||0,u=e.shader||Ya.ReflectorShader,d=e.multisample!==void 0?e.multisample:4,f=new Plane,m=new Vector3,s=new Vector3,o=new Vector3,c=new Matrix4,v=new Vector3(0,0,-1),y=new Vector4,_=new Vector3,b=new Vector3,x=new Vector4,w=new Matrix4,S=this.camera,T=new WebGLRenderTarget(i,a,{samples:d,type:HalfFloatType}),E=new ShaderMaterial({uniforms:UniformsUtils.clone(u.uniforms),fragmentShader:u.fragmentShader,vertexShader:u.vertexShader});E.uniforms.tDiffuse.value=T.texture,E.uniforms.color.value=n,E.uniforms.textureMatrix.value=w,this.material=E,this.onBeforeRender=function(M,P,A){if(s.setFromMatrixPosition(t.matrixWorld),o.setFromMatrixPosition(A.matrixWorld),c.extractRotation(t.matrixWorld),m.set(0,0,1),m.applyMatrix4(c),_.subVectors(s,o),_.dot(m)>0)return;_.reflect(m).negate(),_.add(s),c.extractRotation(A.matrixWorld),v.set(0,0,-1),v.applyMatrix4(c),v.add(o),b.subVectors(s,v),b.reflect(m).negate(),b.add(s),S.position.copy(_),S.up.set(0,1,0),S.up.applyMatrix4(c),S.up.reflect(m),S.lookAt(b),S.far=A.far,S.updateMatrixWorld(),S.projectionMatrix.copy(A.projectionMatrix),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(S.projectionMatrix),w.multiply(S.matrixWorldInverse),w.multiply(t.matrixWorld),f.setFromNormalAndCoplanarPoint(m,s),f.applyMatrix4(S.matrixWorldInverse),y.set(f.normal.x,f.normal.y,f.normal.z,f.constant);const C=S.projectionMatrix;x.x=(Math.sign(y.x)+C.elements[8])/C.elements[0],x.y=(Math.sign(y.y)+C.elements[9])/C.elements[5],x.z=-1,x.w=(1+C.elements[10])/C.elements[14],y.multiplyScalar(2/y.dot(x)),C.elements[2]=y.x,C.elements[6]=y.y,C.elements[10]=y.z+1-l,C.elements[14]=y.w,t.visible=!1;const D=M.getRenderTarget(),k=M.xr.enabled,j=M.shadowMap.autoUpdate,I=M.toneMapping;let W=!1;"outputColorSpace"in M?W=M.outputColorSpace==="srgb":W=M.outputEncoding===3001,M.xr.enabled=!1,M.shadowMap.autoUpdate=!1,"outputColorSpace"in M?M.outputColorSpace="srgb-linear":M.outputEncoding=3e3,M.toneMapping=NoToneMapping,M.setRenderTarget(T),M.state.buffers.depth.setMask(!0),M.autoClear===!1&&M.clear(),M.render(P,S),M.xr.enabled=k,M.shadowMap.autoUpdate=j,M.toneMapping=I,"outputColorSpace"in M?M.outputColorSpace=W?"srgb":"srgb-linear":M.outputEncoding=W?3001:3e3,M.setRenderTarget(D);const L=A.viewport;L!==void 0&&M.state.viewport(L),t.visible=!0},this.getRenderTarget=function(){return T},this.dispose=function(){T.dispose(),t.material.dispose()}}};let pr=Ya;hh(pr,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` - uniform mat4 textureMatrix; - varying vec4 vUv; - - #include - #include - - void main() { - - vUv = textureMatrix * vec4( position, 1.0 ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - #include - - }`,fragmentShader:` - uniform vec3 color; - uniform sampler2D tDiffuse; - varying vec4 vUv; - - #include - - float blendOverlay( float base, float blend ) { - - return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); - - } - - vec3 blendOverlay( vec3 base, vec3 blend ) { - - return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); - - } - - void main() { - - #include - - vec4 base = texture2DProj( tDiffuse, vUv ); - gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); - - #include - #include <${vi>=154?"colorspace_fragment":"encodings_fragment"}> - - }`});var dh=Object.defineProperty,ph=(r,e,t)=>e in r?dh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xa=(r,e,t)=>(ph(r,typeof e!="symbol"?e+"":e,t),t);const ri={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new Vector3},up:{value:new Vector3(0,1,0)}},vertexShader:` - uniform vec3 sunPosition; - uniform float rayleigh; - uniform float turbidity; - uniform float mieCoefficient; - uniform vec3 up; - - varying vec3 vWorldPosition; - varying vec3 vSunDirection; - varying float vSunfade; - varying vec3 vBetaR; - varying vec3 vBetaM; - varying float vSunE; - - // constants for atmospheric scattering - const float e = 2.71828182845904523536028747135266249775724709369995957; - const float pi = 3.141592653589793238462643383279502884197169; - - // wavelength of used primaries, according to preetham - const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); - // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: - // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) - const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); - - // mie stuff - // K coefficient for the primaries - const float v = 4.0; - const vec3 K = vec3( 0.686, 0.678, 0.666 ); - // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K - const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); - - // earth shadow hack - // cutoffAngle = pi / 1.95; - const float cutoffAngle = 1.6110731556870734; - const float steepness = 1.5; - const float EE = 1000.0; - - float sunIntensity( float zenithAngleCos ) { - zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); - return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); - } - - vec3 totalMie( float T ) { - float c = ( 0.2 * T ) * 10E-18; - return 0.434 * c * MieConst; - } - - void main() { - - vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); - vWorldPosition = worldPosition.xyz; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - gl_Position.z = gl_Position.w; // set z to camera.far - - vSunDirection = normalize( sunPosition ); - - vSunE = sunIntensity( dot( vSunDirection, up ) ); - - vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); - - float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); - - // extinction (absorbtion + out scattering) - // rayleigh coefficients - vBetaR = totalRayleigh * rayleighCoefficient; - - // mie coefficients - vBetaM = totalMie( turbidity ) * mieCoefficient; - - } - `,fragmentShader:` - varying vec3 vWorldPosition; - varying vec3 vSunDirection; - varying float vSunfade; - varying vec3 vBetaR; - varying vec3 vBetaM; - varying float vSunE; - - uniform float mieDirectionalG; - uniform vec3 up; - - const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); - - // constants for atmospheric scattering - const float pi = 3.141592653589793238462643383279502884197169; - - const float n = 1.0003; // refractive index of air - const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) - - // optical length at zenith for molecules - const float rayleighZenithLength = 8.4E3; - const float mieZenithLength = 1.25E3; - // 66 arc seconds -> degrees, and the cosine of that - const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; - - // 3.0 / ( 16.0 * pi ) - const float THREE_OVER_SIXTEENPI = 0.05968310365946075; - // 1.0 / ( 4.0 * pi ) - const float ONE_OVER_FOURPI = 0.07957747154594767; - - float rayleighPhase( float cosTheta ) { - return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); - } - - float hgPhase( float cosTheta, float g ) { - float g2 = pow( g, 2.0 ); - float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); - return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); - } - - void main() { - - vec3 direction = normalize( vWorldPosition - cameraPos ); - - // optical length - // cutoff angle at 90 to avoid singularity in next formula. - float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); - float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); - float sR = rayleighZenithLength * inverse; - float sM = mieZenithLength * inverse; - - // combined extinction factor - vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); - - // in scattering - float cosTheta = dot( direction, vSunDirection ); - - float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); - vec3 betaRTheta = vBetaR * rPhase; - - float mPhase = hgPhase( cosTheta, mieDirectionalG ); - vec3 betaMTheta = vBetaM * mPhase; - - vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); - Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); - - // nightsky - float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] - float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] - vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); - vec3 L0 = vec3( 0.1 ) * Fex; - - // composition + solar disc - float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); - L0 += ( vSunE * 19000.0 * Fex ) * sundisk; - - vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); - - vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); - - gl_FragColor = vec4( retColor, 1.0 ); - - #include - #include <${vi>=154?"colorspace_fragment":"encodings_fragment"}> - - } - `},Wa=new ShaderMaterial({name:"SkyShader",fragmentShader:ri.fragmentShader,vertexShader:ri.vertexShader,uniforms:UniformsUtils.clone(ri.uniforms),side:BackSide,depthWrite:!1});class Fr extends Mesh{constructor(){super(new BoxGeometry(1,1,1),Wa)}}Xa(Fr,"SkyShader",ri);Xa(Fr,"material",Wa);new Triangle;new Vector3;new Euler(0,0,0,"YXZ");new Vector3;var Sh=Object.defineProperty,Ah=(r,e,t)=>e in r?Sh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xe=(r,e,t)=>(Ah(r,typeof e!="symbol"?e+"":e,t),t);const Ys=new Ray,uo=new Plane,Ph=Math.cos(70*(Math.PI/180)),ho=(r,e)=>(r%e+e)%e;class Za extends EventDispatcher{constructor(e,t){super(),xe(this,"object"),xe(this,"domElement"),xe(this,"enabled",!0),xe(this,"target",new Vector3),xe(this,"minDistance",0),xe(this,"maxDistance",1/0),xe(this,"minZoom",0),xe(this,"maxZoom",1/0),xe(this,"minPolarAngle",0),xe(this,"maxPolarAngle",Math.PI),xe(this,"minAzimuthAngle",-1/0),xe(this,"maxAzimuthAngle",1/0),xe(this,"enableDamping",!1),xe(this,"dampingFactor",.05),xe(this,"enableZoom",!0),xe(this,"zoomSpeed",1),xe(this,"enableRotate",!0),xe(this,"rotateSpeed",1),xe(this,"enablePan",!0),xe(this,"panSpeed",1),xe(this,"screenSpacePanning",!0),xe(this,"keyPanSpeed",7),xe(this,"zoomToCursor",!1),xe(this,"autoRotate",!1),xe(this,"autoRotateSpeed",2),xe(this,"reverseOrbit",!1),xe(this,"reverseHorizontalOrbit",!1),xe(this,"reverseVerticalOrbit",!1),xe(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),xe(this,"mouseButtons",{LEFT:MOUSE.ROTATE,MIDDLE:MOUSE.DOLLY,RIGHT:MOUSE.PAN}),xe(this,"touches",{ONE:TOUCH.ROTATE,TWO:TOUCH.DOLLY_PAN}),xe(this,"target0"),xe(this,"position0"),xe(this,"zoom0"),xe(this,"_domElementKeyEvents",null),xe(this,"getPolarAngle"),xe(this,"getAzimuthalAngle"),xe(this,"setPolarAngle"),xe(this,"setAzimuthalAngle"),xe(this,"getDistance"),xe(this,"listenToKeyEvents"),xe(this,"stopListenToKeyEvents"),xe(this,"saveState"),xe(this,"reset"),xe(this,"update"),xe(this,"connect"),xe(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>m.phi,this.getAzimuthalAngle=()=>m.theta,this.setPolarAngle=ee=>{let ce=ho(ee,2*Math.PI),wt=m.phi;wt<0&&(wt+=2*Math.PI),ce<0&&(ce+=2*Math.PI);let Ct=Math.abs(ce-wt);2*Math.PI-Ct{let ce=ho(ee,2*Math.PI),wt=m.theta;wt<0&&(wt+=2*Math.PI),ce<0&&(ce+=2*Math.PI);let Ct=Math.abs(ce-wt);2*Math.PI-Ctn.object.position.distanceTo(n.target),this.listenToKeyEvents=ee=>{ee.addEventListener("keydown",bt),this._domElementKeyEvents=ee},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",bt),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),d=u.NONE},this.update=(()=>{const ee=new Vector3,ce=new Vector3(0,1,0),wt=new Quaternion().setFromUnitVectors(e.up,ce),Ct=wt.clone().invert(),It=new Vector3,Dt=new Quaternion,rn=2*Math.PI;return function(){const tn=n.object.position;wt.setFromUnitVectors(e.up,ce),Ct.copy(wt).invert(),ee.copy(tn).sub(n.target),ee.applyQuaternion(wt),m.setFromVector3(ee),n.autoRotate&&d===u.NONE&&I(k()),n.enableDamping?(m.theta+=s.theta*n.dampingFactor,m.phi+=s.phi*n.dampingFactor):(m.theta+=s.theta,m.phi+=s.phi);let Ot=n.minAzimuthAngle,kt=n.maxAzimuthAngle;isFinite(Ot)&&isFinite(kt)&&(Ot<-Math.PI?Ot+=rn:Ot>Math.PI&&(Ot-=rn),kt<-Math.PI?kt+=rn:kt>Math.PI&&(kt-=rn),Ot<=kt?m.theta=Math.max(Ot,Math.min(kt,m.theta)):m.theta=m.theta>(Ot+kt)/2?Math.max(Ot,m.theta):Math.min(kt,m.theta)),m.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,m.phi)),m.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&A||n.object.isOrthographicCamera?m.radius=Z(m.radius):m.radius=Z(m.radius*o),ee.setFromSpherical(m),ee.applyQuaternion(Ct),tn.copy(n.target).add(ee),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(s.theta*=1-n.dampingFactor,s.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(s.set(0,0,0),c.set(0,0,0));let Bt=!1;if(n.zoomToCursor&&A){let ln=null;if(n.object instanceof PerspectiveCamera&&n.object.isPerspectiveCamera){const en=ee.length();ln=Z(en*o);const dn=en-ln;n.object.position.addScaledVector(M,dn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const en=new Vector3(P.x,P.y,0);en.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/o)),n.object.updateProjectionMatrix(),Bt=!0;const dn=new Vector3(P.x,P.y,0);dn.unproject(n.object),n.object.position.sub(dn).add(en),n.object.updateMatrixWorld(),ln=ee.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;ln!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(ln).add(n.object.position):(Ys.origin.copy(n.object.position),Ys.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Ys.direction))f||8*(1-Dt.dot(n.object.quaternion))>f?(n.dispatchEvent(i),It.copy(n.object.position),Dt.copy(n.object.quaternion),Bt=!1,!0):!1}})(),this.connect=ee=>{n.domElement=ee,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Nt),n.domElement.addEventListener("pointerdown",ze),n.domElement.addEventListener("pointercancel",pt),n.domElement.addEventListener("wheel",Ce)},this.dispose=()=>{var ee,ce,wt,Ct,It,Dt;n.domElement&&(n.domElement.style.touchAction="auto"),(ee=n.domElement)==null||ee.removeEventListener("contextmenu",Nt),(ce=n.domElement)==null||ce.removeEventListener("pointerdown",ze),(wt=n.domElement)==null||wt.removeEventListener("pointercancel",pt),(Ct=n.domElement)==null||Ct.removeEventListener("wheel",Ce),(It=n.domElement)==null||It.ownerDocument.removeEventListener("pointermove",be),(Dt=n.domElement)==null||Dt.ownerDocument.removeEventListener("pointerup",pt),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",bt)};const n=this,i={type:"change"},a={type:"start"},l={type:"end"},u={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let d=u.NONE;const f=1e-6,m=new Spherical,s=new Spherical;let o=1;const c=new Vector3,v=new Vector2,y=new Vector2,_=new Vector2,b=new Vector2,x=new Vector2,w=new Vector2,S=new Vector2,T=new Vector2,E=new Vector2,M=new Vector3,P=new Vector2;let A=!1;const C=[],D={};function k(){return 2*Math.PI/60/60*n.autoRotateSpeed}function j(){return Math.pow(.95,n.zoomSpeed)}function I(ee){n.reverseOrbit||n.reverseHorizontalOrbit?s.theta+=ee:s.theta-=ee}function W(ee){n.reverseOrbit||n.reverseVerticalOrbit?s.phi+=ee:s.phi-=ee}const L=(()=>{const ee=new Vector3;return function(ce,wt){ee.setFromMatrixColumn(wt,0),ee.multiplyScalar(-ce),c.add(ee)}})(),U=(()=>{const ee=new Vector3;return function(ce,wt){n.screenSpacePanning===!0?ee.setFromMatrixColumn(wt,1):(ee.setFromMatrixColumn(wt,0),ee.crossVectors(n.object.up,ee)),ee.multiplyScalar(ce),c.add(ee)}})(),H=(()=>{const ee=new Vector3;return function(ce,wt){const Ct=n.domElement;if(Ct&&n.object instanceof PerspectiveCamera&&n.object.isPerspectiveCamera){const It=n.object.position;ee.copy(It).sub(n.target);let Dt=ee.length();Dt*=Math.tan(n.object.fov/2*Math.PI/180),L(2*ce*Dt/Ct.clientHeight,n.object.matrix),U(2*wt*Dt/Ct.clientHeight,n.object.matrix)}else Ct&&n.object instanceof OrthographicCamera&&n.object.isOrthographicCamera?(L(ce*(n.object.right-n.object.left)/n.object.zoom/Ct.clientWidth,n.object.matrix),U(wt*(n.object.top-n.object.bottom)/n.object.zoom/Ct.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function Y(ee){n.object instanceof PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof OrthographicCamera&&n.object.isOrthographicCamera?o/=ee:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function B(ee){n.object instanceof PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof OrthographicCamera&&n.object.isOrthographicCamera?o*=ee:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function X(ee){if(!n.zoomToCursor||!n.domElement)return;A=!0;const ce=n.domElement.getBoundingClientRect(),wt=ee.clientX-ce.left,Ct=ee.clientY-ce.top,It=ce.width,Dt=ce.height;P.x=wt/It*2-1,P.y=-(Ct/Dt)*2+1,M.set(P.x,P.y,1).unproject(n.object).sub(n.object.position).normalize()}function Z(ee){return Math.max(n.minDistance,Math.min(n.maxDistance,ee))}function z(ee){v.set(ee.clientX,ee.clientY)}function _e(ee){X(ee),S.set(ee.clientX,ee.clientY)}function fe(ee){b.set(ee.clientX,ee.clientY)}function We(ee){y.set(ee.clientX,ee.clientY),_.subVectors(y,v).multiplyScalar(n.rotateSpeed);const ce=n.domElement;ce&&(I(2*Math.PI*_.x/ce.clientHeight),W(2*Math.PI*_.y/ce.clientHeight)),v.copy(y),n.update()}function ft(ee){T.set(ee.clientX,ee.clientY),E.subVectors(T,S),E.y>0?Y(j()):E.y<0&&B(j()),S.copy(T),n.update()}function Te(ee){x.set(ee.clientX,ee.clientY),w.subVectors(x,b).multiplyScalar(n.panSpeed),H(w.x,w.y),b.copy(x),n.update()}function G(ee){X(ee),ee.deltaY<0?B(j()):ee.deltaY>0&&Y(j()),n.update()}function K(ee){let ce=!1;switch(ee.code){case n.keys.UP:H(0,n.keyPanSpeed),ce=!0;break;case n.keys.BOTTOM:H(0,-n.keyPanSpeed),ce=!0;break;case n.keys.LEFT:H(n.keyPanSpeed,0),ce=!0;break;case n.keys.RIGHT:H(-n.keyPanSpeed,0),ce=!0;break}ce&&(ee.preventDefault(),n.update())}function ue(){if(C.length==1)v.set(C[0].pageX,C[0].pageY);else{const ee=.5*(C[0].pageX+C[1].pageX),ce=.5*(C[0].pageY+C[1].pageY);v.set(ee,ce)}}function ke(){if(C.length==1)b.set(C[0].pageX,C[0].pageY);else{const ee=.5*(C[0].pageX+C[1].pageX),ce=.5*(C[0].pageY+C[1].pageY);b.set(ee,ce)}}function Ie(){const ee=C[0].pageX-C[1].pageX,ce=C[0].pageY-C[1].pageY,wt=Math.sqrt(ee*ee+ce*ce);S.set(0,wt)}function F(){n.enableZoom&&Ie(),n.enablePan&&ke()}function ge(){n.enableZoom&&Ie(),n.enableRotate&&ue()}function le(ee){if(C.length==1)y.set(ee.pageX,ee.pageY);else{const wt=Rt(ee),Ct=.5*(ee.pageX+wt.x),It=.5*(ee.pageY+wt.y);y.set(Ct,It)}_.subVectors(y,v).multiplyScalar(n.rotateSpeed);const ce=n.domElement;ce&&(I(2*Math.PI*_.x/ce.clientHeight),W(2*Math.PI*_.y/ce.clientHeight)),v.copy(y)}function te(ee){if(C.length==1)x.set(ee.pageX,ee.pageY);else{const ce=Rt(ee),wt=.5*(ee.pageX+ce.x),Ct=.5*(ee.pageY+ce.y);x.set(wt,Ct)}w.subVectors(x,b).multiplyScalar(n.panSpeed),H(w.x,w.y),b.copy(x)}function oe(ee){const ce=Rt(ee),wt=ee.pageX-ce.x,Ct=ee.pageY-ce.y,It=Math.sqrt(wt*wt+Ct*Ct);T.set(0,It),E.set(0,Math.pow(T.y/S.y,n.zoomSpeed)),Y(E.y),S.copy(T)}function pe(ee){n.enableZoom&&oe(ee),n.enablePan&&te(ee)}function Be(ee){n.enableZoom&&oe(ee),n.enableRotate&&le(ee)}function ze(ee){var ce,wt;n.enabled!==!1&&(C.length===0&&((ce=n.domElement)==null||ce.ownerDocument.addEventListener("pointermove",be),(wt=n.domElement)==null||wt.ownerDocument.addEventListener("pointerup",pt)),Yt(ee),ee.pointerType==="touch"?xt(ee):Et(ee))}function be(ee){n.enabled!==!1&&(ee.pointerType==="touch"?Pt(ee):Xe(ee))}function pt(ee){var ce,wt,Ct;Vt(ee),C.length===0&&((ce=n.domElement)==null||ce.releasePointerCapture(ee.pointerId),(wt=n.domElement)==null||wt.ownerDocument.removeEventListener("pointermove",be),(Ct=n.domElement)==null||Ct.ownerDocument.removeEventListener("pointerup",pt)),n.dispatchEvent(l),d=u.NONE}function Et(ee){let ce;switch(ee.button){case 0:ce=n.mouseButtons.LEFT;break;case 1:ce=n.mouseButtons.MIDDLE;break;case 2:ce=n.mouseButtons.RIGHT;break;default:ce=-1}switch(ce){case MOUSE.DOLLY:if(n.enableZoom===!1)return;_e(ee),d=u.DOLLY;break;case MOUSE.ROTATE:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(n.enablePan===!1)return;fe(ee),d=u.PAN}else{if(n.enableRotate===!1)return;z(ee),d=u.ROTATE}break;case MOUSE.PAN:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(n.enableRotate===!1)return;z(ee),d=u.ROTATE}else{if(n.enablePan===!1)return;fe(ee),d=u.PAN}break;default:d=u.NONE}d!==u.NONE&&n.dispatchEvent(a)}function Xe(ee){if(n.enabled!==!1)switch(d){case u.ROTATE:if(n.enableRotate===!1)return;We(ee);break;case u.DOLLY:if(n.enableZoom===!1)return;ft(ee);break;case u.PAN:if(n.enablePan===!1)return;Te(ee);break}}function Ce(ee){n.enabled===!1||n.enableZoom===!1||d!==u.NONE&&d!==u.ROTATE||(ee.preventDefault(),n.dispatchEvent(a),G(ee),n.dispatchEvent(l))}function bt(ee){n.enabled===!1||n.enablePan===!1||K(ee)}function xt(ee){switch($t(ee),C.length){case 1:switch(n.touches.ONE){case TOUCH.ROTATE:if(n.enableRotate===!1)return;ue(),d=u.TOUCH_ROTATE;break;case TOUCH.PAN:if(n.enablePan===!1)return;ke(),d=u.TOUCH_PAN;break;default:d=u.NONE}break;case 2:switch(n.touches.TWO){case TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;F(),d=u.TOUCH_DOLLY_PAN;break;case TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ge(),d=u.TOUCH_DOLLY_ROTATE;break;default:d=u.NONE}break;default:d=u.NONE}d!==u.NONE&&n.dispatchEvent(a)}function Pt(ee){switch($t(ee),d){case u.TOUCH_ROTATE:if(n.enableRotate===!1)return;le(ee),n.update();break;case u.TOUCH_PAN:if(n.enablePan===!1)return;te(ee),n.update();break;case u.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;pe(ee),n.update();break;case u.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Be(ee),n.update();break;default:d=u.NONE}}function Nt(ee){n.enabled!==!1&&ee.preventDefault()}function Yt(ee){C.push(ee)}function Vt(ee){delete D[ee.pointerId];for(let ce=0;cee in r?Qh(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kr=(r,e,t)=>(Jh(r,typeof e!="symbol"?e+"":e,t),t);class Br{constructor(e){kr(this,"data"),this.data=e}generateShapes(e,t=100,n){const i=[],a={letterSpacing:0,lineHeight:1,...n},l=tf(e,t,this.data,a);for(let u=0,d=l.length;u[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:TOUCH.ROTATE,TWO:TOUCH.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(r,{expose:e,emit:t}){const n=r,i=t,{makeDefault:a,autoRotate:l,autoRotateSpeed:u,enableDamping:d,dampingFactor:f,enablePan:m,keyPanSpeed:s,maxAzimuthAngle:o,minAzimuthAngle:c,maxPolarAngle:v,minPolarAngle:y,minDistance:_,maxDistance:b,minZoom:x,maxZoom:w,enableZoom:S,zoomSpeed:T,enableRotate:E,touches:M,rotateSpeed:P,target:A}=toRefs(n),{camera:C,renderer:D,extend:k,controls:j,invalidate:I}=me(),W=ref$1(null);k({OrbitControls:Za}),watch(W,H=>{L(),H&&a.value?j.value=H:j.value=null});function L(){He(W.value,"change",()=>{i("change",W.value),I()}),He(W.value,"start",()=>i("start",W.value)),He(W.value,"end",()=>i("end",W.value))}const{onBeforeRender:U}=Zr();return U(({invalidate:H})=>{W.value&&(d.value||l.value)&&(W.value.update(),l.value&&H())}),onUnmounted(()=>{W.value&&W.value.dispose()}),e({instance:W}),(H,Y)=>(H.camera||unref(C))&&(H.domElement||unref(D))?(openBlock(),createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:W,target:unref(A),"auto-rotate":unref(l),"auto-rotate-speed":unref(u),"enable-damping":unref(d),"damping-factor":unref(f),"enable-pan":unref(m),"key-pan-speed":unref(s),keys:H.keys,"max-azimuth-angle":unref(o),"min-azimuth-angle":unref(c),"max-polar-angle":unref(v),"min-polar-angle":unref(y),"min-distance":unref(_),"max-distance":unref(b),"min-zoom":unref(x),"max-zoom":unref(w),touches:unref(M),"enable-zoom":unref(S),"zoom-speed":unref(T),"enable-rotate":unref(E),"rotate-speed":unref(P),args:[H.camera||unref(C),H.domElement||unref(D).domElement]},null,8,vf)):createCommentVNode("",!0)}});new Matrix4;var fd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qs(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var cl={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,a){function l(f,m){if(!i[f]){if(!n[f]){var s=typeof Qs=="function"&&Qs;if(!m&&s)return s(f,!0);if(u)return u(f,!0);throw new Error("Cannot find module '"+f+"'")}m=i[f]={exports:{}},n[f][0].call(m.exports,function(o){var c=n[f][1][o];return l(c||o)},m,m.exports,t,n,i,a)}return i[f].exports}for(var u=typeof Qs=="function"&&Qs,d=0;d>16),W((65280&C)>>8),W(255&C);return D==2?W(255&(C=M(P.charAt(A))<<2|M(P.charAt(A+1))>>4)):D==1&&(W((C=M(P.charAt(A))<<10|M(P.charAt(A+1))<<4|M(P.charAt(A+2))>>2)>>8&255),W(255&C)),k},v.fromByteArray=function(P){var A,C,D,k,j=P.length%3,I="";function W(L){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(L)}for(A=0,D=P.length-j;A>18&63)+W(k>>12&63)+W(k>>6&63)+W(63&k);switch(j){case 1:I=(I+=W((C=P[P.length-1])>>2))+W(C<<4&63)+"==";break;case 2:I=(I=(I+=W((C=(P[P.length-2]<<8)+P[P.length-1])>>10))+W(C>>4&63))+W(C<<2&63)+"="}return I}})(i===void 0?this.base64js={}:i)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,n,i){(function(a,l,_,d,f,m,s,o,c){var v=t("base64-js"),y=t("ieee754");function _(G,K,ue){if(!(this instanceof _))return new _(G,K,ue);var ke,Ie,F,ge,le=typeof G;if(K==="base64"&&le=="string")for(G=(ge=G).trim?ge.trim():ge.replace(/^\s+|\s+$/g,"");G.length%4!=0;)G+="=";if(le=="number")ke=H(G);else if(le=="string")ke=_.byteLength(G,K);else{if(le!="object")throw new Error("First argument needs to be a number, array or string.");ke=H(G.length)}if(_._useTypedArrays?Ie=_._augment(new Uint8Array(ke)):((Ie=this).length=ke,Ie._isBuffer=!0),_._useTypedArrays&&typeof G.byteLength=="number")Ie._set(G);else if(Y(ge=G)||_.isBuffer(ge)||ge&&typeof ge=="object"&&typeof ge.length=="number")for(F=0;F>8,ge=ge%256,le.push(ge),le.push(F);return le}(K),G,ue,ke)}function w(G,K,ue){var ke="";ue=Math.min(G.length,ue);for(var Ie=K;Ie>>0)):(K+1>>0),Ie}function E(G,K,ue,ke){if(ke||(Te(typeof ue=="boolean","missing or invalid endian"),Te(K!=null,"missing offset"),Te(K+1>>8*(ke?F:1-F)}function D(G,K,ue,ke,Ie){if(Ie||(Te(K!=null,"missing value"),Te(typeof ke=="boolean","missing or invalid endian"),Te(ue!=null,"missing offset"),Te(ue+3>>8*(ke?F:3-F)&255}function k(G,K,ue,ke,Ie){Ie||(Te(K!=null,"missing value"),Te(typeof ke=="boolean","missing or invalid endian"),Te(ue!=null,"missing offset"),Te(ue+1this.length&&(ke=this.length);var Ie=(ke=G.length-K=this.length))return this[G]},_.prototype.readUInt16LE=function(G,K){return S(this,G,!0,K)},_.prototype.readUInt16BE=function(G,K){return S(this,G,!1,K)},_.prototype.readUInt32LE=function(G,K){return T(this,G,!0,K)},_.prototype.readUInt32BE=function(G,K){return T(this,G,!1,K)},_.prototype.readInt8=function(G,K){if(K||(Te(G!=null,"missing offset"),Te(G=this.length))return 128&this[G]?-1*(255-this[G]+1):this[G]},_.prototype.readInt16LE=function(G,K){return E(this,G,!0,K)},_.prototype.readInt16BE=function(G,K){return E(this,G,!1,K)},_.prototype.readInt32LE=function(G,K){return M(this,G,!0,K)},_.prototype.readInt32BE=function(G,K){return M(this,G,!1,K)},_.prototype.readFloatLE=function(G,K){return P(this,G,!0,K)},_.prototype.readFloatBE=function(G,K){return P(this,G,!1,K)},_.prototype.readDoubleLE=function(G,K){return A(this,G,!0,K)},_.prototype.readDoubleBE=function(G,K){return A(this,G,!1,K)},_.prototype.writeUInt8=function(G,K,ue){ue||(Te(G!=null,"missing value"),Te(K!=null,"missing offset"),Te(K=this.length||(this[K]=G)},_.prototype.writeUInt16LE=function(G,K,ue){C(this,G,K,!0,ue)},_.prototype.writeUInt16BE=function(G,K,ue){C(this,G,K,!1,ue)},_.prototype.writeUInt32LE=function(G,K,ue){D(this,G,K,!0,ue)},_.prototype.writeUInt32BE=function(G,K,ue){D(this,G,K,!1,ue)},_.prototype.writeInt8=function(G,K,ue){ue||(Te(G!=null,"missing value"),Te(K!=null,"missing offset"),Te(K=this.length||(0<=G?this.writeUInt8(G,K,ue):this.writeUInt8(255+G+1,K,ue))},_.prototype.writeInt16LE=function(G,K,ue){k(this,G,K,!0,ue)},_.prototype.writeInt16BE=function(G,K,ue){k(this,G,K,!1,ue)},_.prototype.writeInt32LE=function(G,K,ue){j(this,G,K,!0,ue)},_.prototype.writeInt32BE=function(G,K,ue){j(this,G,K,!1,ue)},_.prototype.writeFloatLE=function(G,K,ue){I(this,G,K,!0,ue)},_.prototype.writeFloatBE=function(G,K,ue){I(this,G,K,!1,ue)},_.prototype.writeDoubleLE=function(G,K,ue){W(this,G,K,!0,ue)},_.prototype.writeDoubleBE=function(G,K,ue){W(this,G,K,!1,ue)},_.prototype.fill=function(G,K,ue){if(K=K||0,ue=ue||this.length,Te(typeof(G=typeof(G=G||0)=="string"?G.charCodeAt(0):G)=="number"&&!isNaN(G),"value is not a number"),Te(K<=ue,"end < start"),ue!==K&&this.length!==0){Te(0<=K&&K"},_.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(_._useTypedArrays)return new _(this).buffer;for(var G=new Uint8Array(this.length),K=0,ue=G.length;K=K.length||Ie>=G.length);Ie++)K[Ie+ue]=G[Ie];return Ie}function _e(G){try{return decodeURIComponent(G)}catch{return"�"}}function fe(G,K){Te(typeof G=="number","cannot write a non-number as a number"),Te(0<=G,"specified a negative value for writing an unsigned value"),Te(G<=K,"value is larger than maximum value for type"),Te(Math.floor(G)===G,"value has a fractional component")}function We(G,K,ue){Te(typeof G=="number","cannot write a non-number as a number"),Te(G<=K,"value larger than maximum allowed value"),Te(ue<=G,"value smaller than minimum allowed value"),Te(Math.floor(G)===G,"value has a fractional component")}function ft(G,K,ue){Te(typeof G=="number","cannot write a non-number as a number"),Te(G<=K,"value larger than maximum allowed value"),Te(ue<=G,"value smaller than minimum allowed value")}function Te(G,K){if(!G)throw new Error(K||"Failed assertion")}_._augment=function(G){return G._isBuffer=!0,G._get=G.get,G._set=G.set,G.get=L.get,G.set=L.set,G.write=L.write,G.toString=L.toString,G.toLocaleString=L.toString,G.toJSON=L.toJSON,G.copy=L.copy,G.slice=L.slice,G.readUInt8=L.readUInt8,G.readUInt16LE=L.readUInt16LE,G.readUInt16BE=L.readUInt16BE,G.readUInt32LE=L.readUInt32LE,G.readUInt32BE=L.readUInt32BE,G.readInt8=L.readInt8,G.readInt16LE=L.readInt16LE,G.readInt16BE=L.readInt16BE,G.readInt32LE=L.readInt32LE,G.readInt32BE=L.readInt32BE,G.readFloatLE=L.readFloatLE,G.readFloatBE=L.readFloatBE,G.readDoubleLE=L.readDoubleLE,G.readDoubleBE=L.readDoubleBE,G.writeUInt8=L.writeUInt8,G.writeUInt16LE=L.writeUInt16LE,G.writeUInt16BE=L.writeUInt16BE,G.writeUInt32LE=L.writeUInt32LE,G.writeUInt32BE=L.writeUInt32BE,G.writeInt8=L.writeInt8,G.writeInt16LE=L.writeInt16LE,G.writeInt16BE=L.writeInt16BE,G.writeInt32LE=L.writeInt32LE,G.writeInt32BE=L.writeInt32BE,G.writeFloatLE=L.writeFloatLE,G.writeFloatBE=L.writeFloatBE,G.writeDoubleLE=L.writeDoubleLE,G.writeDoubleBE=L.writeDoubleBE,G.fill=L.fill,G.inspect=L.inspect,G.toArrayBuffer=L.toArrayBuffer,G}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,n,i){(function(a,l,v,d,f,m,s,o,c){var v=t("buffer").Buffer,y=4,_=new v(y);_.fill(0),n.exports={hash:function(b,x,w,S){for(var T=x(function(C,D){C.length%y!=0&&(k=C.length+(y-C.length%y),C=v.concat([C,_],k));for(var k,j=[],I=D?C.readInt32BE:C.readInt32LE,W=0;Ww?U=L(U):U.length>5]|=128<>>9<<4)]=M;for(var P=1732584193,A=-271733879,C=-1732584194,D=271733878,k=0;k>>32-C,P)}function b(E,M,P,A,C,D,k){return _(M&P|~M&A,E,M,C,D,k)}function x(E,M,P,A,C,D,k){return _(M&A|P&~A,E,M,C,D,k)}function w(E,M,P,A,C,D,k){return _(M^P^A,E,M,C,D,k)}function S(E,M,P,A,C,D,k){return _(P^(M|~A),E,M,C,D,k)}function T(E,M){var P=(65535&E)+(65535&M);return(E>>16)+(M>>16)+(P>>16)<<16|65535&P}n.exports=function(E){return v.hash(E,y,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,n,i){(function(a,l,u,d,f,m,s,o,c){n.exports=function(v){for(var y,_=new Array(v),b=0;b>>((3&b)<<3)&255;return _}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,n,i){(function(a,l,u,d,f,m,s,o,c){var v=t("./helpers");function y(x,w){x[w>>5]|=128<<24-w%32,x[15+(w+64>>9<<4)]=w;for(var S,T,E,M=Array(80),P=1732584193,A=-271733879,C=-1732584194,D=271733878,k=-1009589776,j=0;j>16)+(w>>16)+(S>>16)<<16|65535&S}function b(x,w){return x<>>32-w}n.exports=function(x){return v.hash(x,y,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,n,i){(function(a,l,u,d,f,m,s,o,c){function v(w,S){var T=(65535&w)+(65535&S);return(w>>16)+(S>>16)+(T>>16)<<16|65535&T}function y(w,S){var T,E=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),M=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),P=new Array(64);w[S>>5]|=128<<24-S%32,w[15+(S+64>>9<<4)]=S;for(var A,C,D=0;D>>S|w<<32-S},x=function(w,S){return w>>>S};n.exports=function(w){return _.hash(w,y,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,n,i){(function(a,l,u,d,f,m,s,o,c){i.read=function(v,y,_,b,D){var w,S,T=8*D-b-1,E=(1<>1,P=-7,A=_?D-1:0,C=_?-1:1,D=v[y+A];for(A+=C,w=D&(1<<-P)-1,D>>=-P,P+=T;0>=-P,P+=b;0>1,A=x===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=b?0:k-1,D=b?1:-1,k=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===1/0?(T=isNaN(y)?1:0,S=M):(S=Math.floor(Math.log(y)/Math.LN2),y*(b=Math.pow(2,-S))<1&&(S--,b*=2),2<=(y+=1<=S+P?A/b:A*Math.pow(2,1-P))*b&&(S++,b/=2),M<=S+P?(T=0,S=M):1<=S+P?(T=(y*b-1)*Math.pow(2,x),S+=P):(T=y*Math.pow(2,P-1)*Math.pow(2,x),S=0));8<=x;v[_+C]=255&T,C+=D,T/=256,x-=8);for(S=S<":` - vec3 objectNormal = `.concat(Ee.normal,`; - #ifdef USE_TANGENT - vec3 objectTangent = vec3( tangent.xyz ); - #endif - `)}),Ue(ut,"".concat(Ee.position),{"#include ":` - vec3 transformed = `.concat(Ee.position,`; - `)}),Ue(ut,"".concat(Ee.positionRaw),{"#include ":` - vec4 csm_internal_positionUnprojected = `.concat(Ee.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; - `)}),Ue(ut,"".concat(Ee.pointSize),{"gl_PointSize = size;":` - gl_PointSize = `.concat(Ee.pointSize,`; - `)}),Ue(ut,"".concat(Ee.diffuseColor),{"#include ":` - #include - diffuseColor = `.concat(Ee.diffuseColor,`; - `)}),Ue(ut,"".concat(Ee.fragColor),{"#include ":` - #include - gl_FragColor = `.concat(Ee.fragColor,`; - `)}),Ue(ut,"".concat(Ee.emissive),{"vec3 totalEmissiveRadiance = emissive;":` - vec3 totalEmissiveRadiance = `.concat(Ee.emissive,`; - `)}),Ue(ut,"".concat(Ee.roughness),{"#include ":` - #include - roughnessFactor = `.concat(Ee.roughness,`; - `)}),Ue(ut,"".concat(Ee.metalness),{"#include ":` - #include - metalnessFactor = `.concat(Ee.metalness,`; - `)}),Ue(ut,"".concat(Ee.ao),{"#include ":` - #include - reflectedLight.indirectDiffuse *= 1. - `.concat(Ee.ao,`; - `)}),Ue(ut,"".concat(Ee.bump),{"#include ":` - #include - - vec3 csm_internal_orthogonal = `.concat(Ee.bump," - (dot(").concat(Ee.bump,`, normal) * normal); - vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; - normal = normalize(normal - csm_internal_projectedbump); - `)}),Ue(ut,"".concat(Ee.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(Ee.depthAlpha,` ); - `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` - gl_FragColor = packDepthToRGBA( fragCoordZ ); - gl_FragColor.a *= `.concat(Ee.depthAlpha,`; - `)});Zn={},Ue(Zn,"".concat(Ee.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` - gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(Ee.position,`, 1.0 ); - `)}),Ue(Zn,"".concat(Ee.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` - gl_Position = `.concat(Ee.position,`; - `)}),Ue(Zn,"".concat(Ee.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` - gl_FragColor = `.concat(Ee.diffuseColor,`; - `)}),Ue(Zn,"".concat(Ee.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` - gl_FragColor = `.concat(Ee.fragColor,`; - `)});var ht;ht={},Ue(ht,"".concat(Ee.position),"*"),Ue(ht,"".concat(Ee.positionRaw),"*"),Ue(ht,"".concat(Ee.normal),"*"),Ue(ht,"".concat(Ee.pointSize),["PointsMaterial"]),Ue(ht,"".concat(Ee.diffuseColor),"*"),Ue(ht,"".concat(Ee.fragColor),"*"),Ue(ht,"".concat(Ee.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ue(ht,"".concat(Ee.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ue(ht,"".concat(Ee.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ue(ht,"".concat(Ee.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Ue(ht,"".concat(Ee.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Ue(ht,"".concat(Ee.depthAlpha),"*");var Pp=`void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); -}`,Cp=`#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 Os=new Vector3(0,0,0),zr=new Vector3(0,0,0),Rp=new Vector3(0,0,0);function Ko(r,e,t){const n=Os.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,a=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*i+i,-(n.y*a)+a]}function Ip(r,e){const t=Os.setFromMatrixPosition(r.matrixWorld),n=zr.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),a=e.getWorldDirection(Rp);return i.angleTo(a)>Math.PI/2}function Op(r,e,t,n){const i=Os.setFromMatrixPosition(r.matrixWorld),a=i.clone();a.project(e),t.setFromCamera(new Vector2(a.x,a.y),e);const l=t.intersectObjects(n,!0);if(l.length>0){const u=l[0].distance;return i.distanceTo(t.ray.origin)Math.abs(r)<1e-10?0:r;function gl(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=xr(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const Fp=(r=>e=>gl(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),kp=(r=>(e,t)=>gl(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]),Bp=["geometry","material"];new PlaneGeometry;var yl={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(fd,function(){var t=function(){function n(c){return l.appendChild(c.dom),c}function i(c){for(var v=0;vd+1e3&&(m.update(1e3*f/(c-d),100),d=c,f=0,o)){var v=performance.memory;o.update(v.usedJSHeapSize/1048576,v.jsHeapSizeLimit/1048576)}return c},update:function(){u=this.end()},domElement:l,setMode:i}};return t.Panel=function(n,i,a){var l=1/0,u=0,d=Math.round,f=d(window.devicePixelRatio||1),m=80*f,s=48*f,o=3*f,c=2*f,v=3*f,y=15*f,_=74*f,b=30*f,x=document.createElement("canvas");x.width=m,x.height=s,x.style.cssText="width:80px;height:48px";var w=x.getContext("2d");return w.font="bold "+9*f+"px Helvetica,Arial,sans-serif",w.textBaseline="top",w.fillStyle=a,w.fillRect(0,0,m,s),w.fillStyle=i,w.fillText(n,o,c),w.fillRect(v,y,_,b),w.fillStyle=a,w.globalAlpha=.9,w.fillRect(v,y,_,b),{dom:x,update:function(S,T){l=Math.min(l,S),u=Math.max(u,S),w.fillStyle=a,w.globalAlpha=1,w.fillRect(0,0,m,y),w.fillStyle=i,w.fillText(d(S)+" "+n+" ("+d(l)+"-"+d(u)+")",o,c),w.drawImage(x,v+f,y,_-f,b,v,y,_-f,b),w.fillRect(v+_-f,y,f,b),w.fillStyle=a,w.globalAlpha=.9,w.fillRect(v+_-f,y,f,d((1-S/T)*b))}}},t})})(yl);new Box3;new Vector3;UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};ShaderLib.line={uniforms:UniformsUtils.merge([UniformsLib.common,UniformsLib.fog,UniformsLib.line]),vertexShader:` - #include - #include - #include - #include - #include - - uniform float linewidth; - uniform vec2 resolution; - - attribute vec3 instanceStart; - attribute vec3 instanceEnd; - - attribute vec3 instanceColorStart; - attribute vec3 instanceColorEnd; - - #ifdef WORLD_UNITS - - varying vec4 worldPos; - varying vec3 worldStart; - varying vec3 worldEnd; - - #ifdef USE_DASH - - varying vec2 vUv; - - #endif - - #else - - varying vec2 vUv; - - #endif - - #ifdef USE_DASH - - uniform float dashScale; - attribute float instanceDistanceStart; - attribute float instanceDistanceEnd; - varying float vLineDistance; - - #endif - - void trimSegment( const in vec4 start, inout vec4 end ) { - - // trim end segment so it terminates between the camera plane and the near plane - - // conservative estimate of the near plane - float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column - float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column - float nearEstimate = - 0.5 * b / a; - - float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); - - end.xyz = mix( start.xyz, end.xyz, alpha ); - - } - - void main() { - - #ifdef USE_COLOR - - vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; - - #endif - - #ifdef USE_DASH - - vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; - vUv = uv; - - #endif - - float aspect = resolution.x / resolution.y; - - // camera space - vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); - vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); - - #ifdef WORLD_UNITS - - worldStart = start.xyz; - worldEnd = end.xyz; - - #else - - vUv = uv; - - #endif - - // special case for perspective projection, and segments that terminate either in, or behind, the camera plane - // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space - // but we need to perform ndc-space calculations in the shader, so we must address this issue directly - // perhaps there is a more elegant solution -- WestLangley - - bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column - - if ( perspective ) { - - if ( start.z < 0.0 && end.z >= 0.0 ) { - - trimSegment( start, end ); - - } else if ( end.z < 0.0 && start.z >= 0.0 ) { - - trimSegment( end, start ); - - } - - } - - // clip space - vec4 clipStart = projectionMatrix * start; - vec4 clipEnd = projectionMatrix * end; - - // ndc space - vec3 ndcStart = clipStart.xyz / clipStart.w; - vec3 ndcEnd = clipEnd.xyz / clipEnd.w; - - // direction - vec2 dir = ndcEnd.xy - ndcStart.xy; - - // account for clip-space aspect ratio - dir.x *= aspect; - dir = normalize( dir ); - - #ifdef WORLD_UNITS - - vec3 worldDir = normalize( end.xyz - start.xyz ); - vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) ); - vec3 worldUp = normalize( cross( worldDir, tmpFwd ) ); - vec3 worldFwd = cross( worldDir, worldUp ); - worldPos = position.y < 0.5 ? start: end; - - // height offset - float hw = linewidth * 0.5; - worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp; - - // don't extend the line if we're rendering dashes because we - // won't be rendering the endcaps - #ifndef USE_DASH - - // cap extension - worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir; - - // add width to the box - worldPos.xyz += worldFwd * hw; - - // endcaps - if ( position.y > 1.0 || position.y < 0.0 ) { - - worldPos.xyz -= worldFwd * 2.0 * hw; - - } - - #endif - - // project the worldpos - vec4 clip = projectionMatrix * worldPos; - - // shift the depth of the projected points so the line - // segments overlap neatly - vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; - clip.z = clipPose.z * clip.w; - - #else - - vec2 offset = vec2( dir.y, - dir.x ); - // undo aspect ratio adjustment - dir.x /= aspect; - offset.x /= aspect; - - // sign flip - if ( position.x < 0.0 ) offset *= - 1.0; - - // endcaps - if ( position.y < 0.0 ) { - - offset += - dir; - - } else if ( position.y > 1.0 ) { - - offset += dir; - - } - - // adjust for linewidth - offset *= linewidth; - - // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... - offset /= resolution.y; - - // select end - vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; - - // back to clip space - offset *= clip.w; - - clip.xy += offset; - - #endif - - gl_Position = clip; - - vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation - - #include - #include - #include - - } - `,fragmentShader:` - uniform vec3 diffuse; - uniform float opacity; - uniform float linewidth; - - #ifdef USE_DASH - - uniform float dashOffset; - uniform float dashSize; - uniform float gapSize; - - #endif - - varying float vLineDistance; - - #ifdef WORLD_UNITS - - varying vec4 worldPos; - varying vec3 worldStart; - varying vec3 worldEnd; - - #ifdef USE_DASH - - varying vec2 vUv; - - #endif - - #else - - varying vec2 vUv; - - #endif - - #include - #include - #include - #include - #include - - vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { - - float mua; - float mub; - - vec3 p13 = p1 - p3; - vec3 p43 = p4 - p3; - - vec3 p21 = p2 - p1; - - float d1343 = dot( p13, p43 ); - float d4321 = dot( p43, p21 ); - float d1321 = dot( p13, p21 ); - float d4343 = dot( p43, p43 ); - float d2121 = dot( p21, p21 ); - - float denom = d2121 * d4343 - d4321 * d4321; - - float numer = d1343 * d4321 - d1321 * d4343; - - mua = numer / denom; - mua = clamp( mua, 0.0, 1.0 ); - mub = ( d1343 + d4321 * ( mua ) ) / d4343; - mub = clamp( mub, 0.0, 1.0 ); - - return vec2( mua, mub ); - - } - - void main() { - - #include - - #ifdef USE_DASH - - if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps - - if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX - - #endif - - float alpha = opacity; - - #ifdef WORLD_UNITS - - // Find the closest points on the view ray and the line segment - vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; - vec3 lineDir = worldEnd - worldStart; - vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); - - vec3 p1 = worldStart + lineDir * params.x; - vec3 p2 = rayEnd * params.y; - vec3 delta = p1 - p2; - float len = length( delta ); - float norm = len / linewidth; - - #ifndef USE_DASH - - #ifdef USE_ALPHA_TO_COVERAGE - - float dnorm = fwidth( norm ); - alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); - - #else - - if ( norm > 0.5 ) { - - discard; - - } - - #endif - - #endif - - #else - - #ifdef USE_ALPHA_TO_COVERAGE - - // artifacts appear on some hardware if a derivative is taken within a conditional - float a = vUv.x; - float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; - float len2 = a * a + b * b; - float dlen = fwidth( len2 ); - - if ( abs( vUv.y ) > 1.0 ) { - - alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); - - } - - #else - - if ( abs( vUv.y ) > 1.0 ) { - - float a = vUv.x; - float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; - float len2 = a * a + b * b; - - if ( len2 > 1.0 ) discard; - - } - - #endif - - #endif - - vec4 diffuseColor = vec4( diffuse, alpha ); - - #include - #include - - gl_FragColor = vec4( diffuseColor.rgb, alpha ); - - #include - #include - #include - #include - - } - `};new Vector4;new Vector3;new Vector3;new Vector4;new Vector4;new Vector4;new Vector3;new Matrix4;new Line3;new Vector3;new Box3;new Sphere;new Vector4;const og={key:0,args:[0,1,64]},ag={key:1,args:[.5,1,64]},lg={key:2},cg=["tone-mapped","map","side","color"];new Color(16777215);const _hoisted_1$3={flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},_hoisted_2$3={op50:""},_hoisted_3$2={key:0,"w-full":""},_sfc_main$5=defineComponent({__name:"Collapsable",props:mergeModels({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const e=r,t=useModel(r,"modelValue");return watchEffect(()=>{e.default!=null&&(t.value=!!e.default)}),(n,i)=>(openBlock(),createElementBlock("div",_hoisted_1$3,[createBaseVNode("button",{sticky:"","top-0":"","z-10":"",flex:"","items-center":"","justify-between":"",px2:"",py1:"","text-sm":"","backdrop-blur-xl":"",onClick:i[0]||(i[0]=a=>t.value=!t.value)},[createBaseVNode("span",null,[renderSlot(n.$slots,"label",{},()=>[createTextVNode(toDisplayString(e.label??"Collapsable"),1)])]),i[1]||(i[1]=createTextVNode()),createBaseVNode("span",_hoisted_2$3,toDisplayString(t.value?"▲":"▼"),1)]),createVNode(_sfc_main$h,null,{default:withCtx(()=>[t.value?(openBlock(),createElementBlock("div",_hoisted_3$2,[renderSlot(n.$slots,"default")])):createCommentVNode("",!0)]),_:3})]))}}),_sfc_main$4=defineComponent({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(r,{emit:e}){const t=r,n=e,i=ref$1(null);function a(v,y,_){return Math.min(Math.max(v,y),_)}function l(v){const y=v.toString();return y.includes("e-")?Number.parseInt(y.split("e-")[1],10):y.includes(".")?y.split(".")[1].length:0}function u(v,y){const _=l(y),b=10**(_+3);return Number.parseFloat((v*b/b).toFixed(_))}const d=computed(()=>u(a(t.modelValue,t.min,t.max),t.step)),f=computed(()=>{const v=(d.value-t.min)/(t.max-t.min)*100;return{width:`${v}%`,backgroundSize:`${v}% 100%`}});function m(v){if(!i.value)return d.value;const y=i.value.getBoundingClientRect(),b=(v.clientX-y.left)/y.width,x=t.max-t.min,w=t.min+x*b,S=Math.round(w/t.step)*t.step;return Math.min(Math.max(S,t.min),t.max)}function s(v){if(t.disabled)return;const y=m(v);n("update:modelValue",y)}function o(v){if(t.disabled)return;v.preventDefault();const y=m(v);n("update:modelValue",y),window.addEventListener("mousemove",s),window.addEventListener("mouseup",c)}function c(v){window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}return onUnmounted(()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",c)}),(v,y)=>(openBlock(),createElementBlock("span",{ref_key:"sliderRef",ref:i,class:normalizeClass(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:r.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:o},[createBaseVNode("span",{style:normalizeStyle(f.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),createBaseVNode("span",{role:"slider",class:"slider-thumb",style:normalizeStyle({left:`${(d.value-r.min)/(r.max-r.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"zinc-100 dark:zinc-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});/*! - * @pixiv/three-vrm-animation v3.3.2 - * The implementation of VRM Animation - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-animation is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */var __async$1=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),VRMExpressionPresetName$1={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};new Color;new Vector2;new Vector3;new Vector3;var VRMHumanBoneParentMap$1={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function quatInvertCompat$1(r){return r.invert?r.invert():r.inverse(),r}new Vector3;new Vector3;new Vector3;new Vector3;new Vector3;new Vector3(0,1,0);var _position$1=new Vector3,_scale$1=new Vector3;function getWorldQuaternionLite$1(r,e){return r.matrixWorld.decompose(_position$1,e,_scale$1),e}function calcAzimuthAltitude$1(r){return[Math.atan2(-r.z,r.x),Math.atan2(r.y,Math.sqrt(r.x*r.x+r.z*r.z))]}function sanitizeAngle$1(r){const e=Math.round(r/2/Math.PI);return r-2*Math.PI*e}var VEC3_POSITIVE_Z$1=new Vector3(0,0,1),_v3A5$1=new Vector3,_v3B3$1=new Vector3,_v3C$1=new Vector3,_quatA5$1=new Quaternion,_quatB2$1=new Quaternion,_quatC$1=new Quaternion,_quatD$1=new Quaternion,_eulerA$1=new Euler,_VRMLookAt$1=class Gr{constructor(e,t){this.offsetFromHeadBone=new Vector3,this.autoUpdate=!0,this.faceFront=new Vector3(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new Quaternion)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new Euler)}getEuler(e){return e.set(MathUtils.DEG2RAD*this._pitch,MathUtils.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new Gr(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getRawBoneNode("head");return getWorldQuaternionLite$1(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(VEC3_POSITIVE_Z$1)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,n]=calcAzimuthAltitude$1(this.faceFront);return _eulerA$1.set(0,.5*Math.PI+t,n,"YZX"),e.setFromEuler(_eulerA$1).premultiply(_quatD$1.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(_quatB2$1),this.getFaceFrontQuaternion(_quatC$1),e.copy(VEC3_POSITIVE_Z$1).applyQuaternion(_quatB2$1).applyQuaternion(_quatC$1).applyEuler(this.getEuler(_eulerA$1))}lookAt(e){const t=_quatA5$1.copy(this._restHeadWorldQuaternion).multiply(quatInvertCompat$1(this.getLookAtWorldQuaternion(_quatB2$1))),n=this.getLookAtWorldPosition(_v3B3$1),i=_v3C$1.copy(e).sub(n).applyQuaternion(t).normalize(),[a,l]=calcAzimuthAltitude$1(this.faceFront),[u,d]=calcAzimuthAltitude$1(i),f=sanitizeAngle$1(u-a),m=sanitizeAngle$1(l-d);this._yaw=MathUtils.RAD2DEG*f,this._pitch=MathUtils.RAD2DEG*m,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(_v3A5$1)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};_VRMLookAt$1.EULER_ORDER="YXZ";var VRMLookAt$1=_VRMLookAt$1;new Vector3(0,0,1);new Euler(0,0,0,"YXZ");var RAD2DEG=180/Math.PI,_eulerA3=new Euler,VRMLookAtQuaternionProxy=class extends Object3D{constructor(r){super(),this.vrmLookAt=r,this.type="VRMLookAtQuaternionProxy";const e=this.rotation._onChangeCallback;this.rotation._onChange(()=>{e(),this._applyToLookAt()});const t=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{t(),this._applyToLookAt()})}_applyToLookAt(){_eulerA3.setFromQuaternion(this.quaternion,VRMLookAt$1.EULER_ORDER),this.vrmLookAt.yaw=RAD2DEG*_eulerA3.y,this.vrmLookAt.pitch=RAD2DEG*_eulerA3.x}};function createVRMAnimationHumanoidTracks(r,e,t){var n,i;const a=new Map,l=new Map;for(const[u,d]of r.humanoidTracks.rotation.entries()){const f=(n=e.getNormalizedBoneNode(u))==null?void 0:n.name;if(f!=null){const m=new QuaternionKeyframeTrack(`${f}.quaternion`,d.times,d.values.map((s,o)=>t==="0"&&o%2===0?-s:s));l.set(u,m)}}for(const[u,d]of r.humanoidTracks.translation.entries()){const f=(i=e.getNormalizedBoneNode(u))==null?void 0:i.name;if(f!=null){const m=r.restHipsPosition.y,o=e.normalizedRestPose.hips.position[1]/m,c=d.clone();c.values=c.values.map((v,y)=>(t==="0"&&y%3!==1?-v:v)*o),c.name=`${f}.position`,a.set(u,c)}}return{translation:a,rotation:l}}function createVRMAnimationExpressionTracks(r,e){const t=new Map,n=new Map;for(const[i,a]of r.expressionTracks.preset.entries()){const l=e.getExpressionTrackName(i);if(l!=null){const u=a.clone();u.name=l,t.set(i,u)}}for(const[i,a]of r.expressionTracks.custom.entries()){const l=e.getExpressionTrackName(i);if(l!=null){const u=a.clone();u.name=l,n.set(i,u)}}return{preset:t,custom:n}}function createVRMAnimationLookAtTrack(r,e){if(r.lookAtTrack==null)return null;const t=r.lookAtTrack.clone();return t.name=e,t}function createVRMAnimationClip(r,e){const t=[],n=createVRMAnimationHumanoidTracks(r,e.humanoid,e.meta.metaVersion);if(t.push(...n.translation.values()),t.push(...n.rotation.values()),e.expressionManager!=null){const i=createVRMAnimationExpressionTracks(r,e.expressionManager);t.push(...i.preset.values()),t.push(...i.custom.values())}if(e.lookAt!=null){let i=e.scene.children.find(l=>l instanceof VRMLookAtQuaternionProxy);i==null?(console.warn("createVRMAnimationClip: VRMLookAtQuaternionProxy is not found. Creating a new one automatically. To suppress this warning, create a VRMLookAtQuaternionProxy manually"),i=new VRMLookAtQuaternionProxy(e.lookAt),i.name="VRMLookAtQuaternionProxy",e.scene.add(i)):i.name==null&&(console.warn("createVRMAnimationClip: VRMLookAtQuaternionProxy is found but its name is not set. Setting the name automatically. To suppress this warning, set the name manually"),i.name="VRMLookAtQuaternionProxy");const a=createVRMAnimationLookAtTrack(r,`${i.name}.quaternion`);a!=null&&t.push(a)}return new AnimationClip("Clip",r.duration,t)}var VRMAnimation=class{constructor(){this.duration=0,this.restHipsPosition=new Vector3,this.humanoidTracks={translation:new Map,rotation:new Map},this.expressionTracks={preset:new Map,custom:new Map},this.lookAtTrack=null}};function arrayChunk(r,e){const t=r.length,n=[];let i=[],a=0;for(let l=0;l{const b=i.animations[_],x=this._parseAnimation(y,b,d,f);return x.restHipsPosition=o,x});r.userData.vrmAnimations=v})}_createNodeMap(r){var e,t,n,i,a;const l=new Map,u=new Map,d=(e=r.humanoid)==null?void 0:e.humanBones;d&&Object.entries(d).forEach(([o,c])=>{const v=c==null?void 0:c.node;v!=null&&l.set(v,o)});const f=(t=r.expressions)==null?void 0:t.preset;f&&Object.entries(f).forEach(([o,c])=>{const v=c==null?void 0:c.node;v!=null&&u.set(v,o)});const m=(n=r.expressions)==null?void 0:n.custom;m&&Object.entries(m).forEach(([o,c])=>{const{node:v}=c;u.set(v,o)});const s=(a=(i=r.lookAt)==null?void 0:i.node)!=null?a:null;return{humanoidIndexToName:l,expressionsIndexToName:u,lookAtIndex:s}}_createBoneWorldMatrixMap(r,e){return __async$1(this,null,function*(){var t,n;r.scene.updateWorldMatrix(!1,!0);const i=yield r.parser.getDependencies("node"),a=new Map;if(e.humanoid==null)return a;for(const[l,u]of Object.entries(e.humanoid.humanBones)){const d=u==null?void 0:u.node;if(d!=null){const f=i[d];a.set(l,f.matrixWorld),l==="hips"&&a.set("hipsParent",(n=(t=f.parent)==null?void 0:t.matrixWorld)!=null?n:MAT4_IDENTITY)}}return a})}_parseAnimation(r,e,t,n){const i=r.tracks,a=e.channels,l=new VRMAnimation;return l.duration=r.duration,a.forEach((u,d)=>{const{node:f,path:m}=u.target,s=i[d];if(f==null)return;const o=t.humanoidIndexToName.get(f);if(o!=null){let v=VRMHumanBoneParentMap$1[o];for(;v!=null&&n.get(v)==null;)v=VRMHumanBoneParentMap$1[v];if(v??(v="hipsParent"),m==="translation")if(o!=="hips")console.warn(`The loading animation contains a translation track for ${o}, which is not permitted in the VRMC_vrm_animation spec. ignoring the track`);else{const y=n.get("hipsParent"),_=arrayChunk(s.values,3).flatMap(x=>_v3A6$1.fromArray(x).applyMatrix4(y).toArray()),b=s.clone();b.values=new Float32Array(_),l.humanoidTracks.translation.set(o,b)}else if(m==="rotation"){const y=n.get(o),_=n.get(v);y.decompose(_v3A6$1,_quatA7$1,_v3A6$1),_quatA7$1.invert(),_.decompose(_v3A6$1,_quatB4$1,_v3A6$1);const b=arrayChunk(s.values,4).flatMap(w=>_quatC2$1.fromArray(w).premultiply(_quatB4$1).multiply(_quatA7$1).toArray()),x=s.clone();x.values=new Float32Array(b),l.humanoidTracks.rotation.set(o,x)}else throw new Error(`Invalid path "${m}"`);return}const c=t.expressionsIndexToName.get(f);if(c!=null){if(m==="translation"){const v=s.times,y=new Float32Array(s.values.length/3);for(let b=0;bnew Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),__async2=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),VRMExpression=class extends Object3D{constructor(r){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${r}`,this.expressionName=r,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(r){this._binds.push(r)}deleteBind(r){const e=this._binds.indexOf(r);e>=0&&this._binds.splice(e,1)}applyWeight(r){var e;let t=this.outputWeight;t*=(e=r==null?void 0:r.multiplier)!=null?e:1,this.isBinary&&t<1&&(t=0),this._binds.forEach(n=>n.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(r=>r.clearAppliedWeight())}};function extractPrimitivesInternal(r,e,t){var n,i;const a=r.parser.json,l=(n=a.nodes)==null?void 0:n[e];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const u=l.mesh;if(u==null)return null;const d=(i=a.meshes)==null?void 0:i[u];if(d==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${u}] of glTF but the mesh doesn't exist`),null;const f=d.primitives.length,m=[];return t.traverse(s=>{m.length{const a=extractPrimitivesInternal(r,i,n);a!=null&&t.set(i,a)}),t})}var VRMExpressionPresetName={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function saturate(r){return Math.max(Math.min(r,1),0)}var VRMExpressionManager=class Wr{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(VRMExpressionPresetName));return Object.entries(this._expressionMap).forEach(([n,i])=>{t.has(n)&&(e[n]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(VRMExpressionPresetName));return Object.entries(this._expressionMap).forEach(([n,i])=>{t.has(n)||(e[n]=i)}),e}copy(e){return this._expressions.concat().forEach(n=>{this.unregisterExpression(n)}),e._expressions.forEach(n=>{this.registerExpression(n)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new Wr().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const n=this.getExpression(e);return(t=n==null?void 0:n.weight)!=null?t:null}setValue(e,t){const n=this.getExpression(e);n&&(n.weight=saturate(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let n=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(n*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(n*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(n*=e.mouth),t.applyWeight({multiplier:n})})}_calculateWeightMultipliers(){let e=1,t=1,n=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,n-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),n=Math.max(0,n),{blink:e,lookAt:t,mouth:n}}},VRMExpressionMaterialColorType={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},v0ExpressionMaterialColorMap={_Color:VRMExpressionMaterialColorType.Color,_EmissionColor:VRMExpressionMaterialColorType.EmissionColor,_ShadeColor:VRMExpressionMaterialColorType.ShadeColor,_RimColor:VRMExpressionMaterialColorType.RimColor,_OutlineColor:VRMExpressionMaterialColorType.OutlineColor},_color=new Color,_VRMExpressionMaterialColorBind=class qr{constructor({material:e,type:t,targetValue:n,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=n,this.targetAlpha=i??1;const a=this._initColorBindState(),l=this._initAlphaBindState();this._state={color:a,alpha:l}}applyWeight(e){const{color:t,alpha:n}=this._state;if(t!=null){const{propertyName:i,deltaValue:a}=t,l=this.material[i];l!=null&&l.add(_color.copy(a).multiplyScalar(e))}if(n!=null){const{propertyName:i,deltaValue:a}=n;this.material[i]!=null&&(this.material[i]+=a*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:n,initialValue:i}=e,a=this.material[n];a!=null&&a.copy(i)}if(t!=null){const{propertyName:n,initialValue:i}=t;this.material[n]!=null&&(this.material[n]=i)}}_initColorBindState(){var e,t,n;const{material:i,type:a,targetValue:l}=this,u=this._getPropertyNameMap(),d=(t=(e=u==null?void 0:u[a])==null?void 0:e[0])!=null?t:null;if(d==null)return console.warn(`Tried to add a material color bind to the material ${(n=i.name)!=null?n:"(no name)"}, the type ${a} but the material or the type is not supported.`),null;const m=i[d].clone(),s=new Color(l.r-m.r,l.g-m.g,l.b-m.b);return{propertyName:d,initialValue:m,deltaValue:s}}_initAlphaBindState(){var e,t,n;const{material:i,type:a,targetAlpha:l}=this,u=this._getPropertyNameMap(),d=(t=(e=u==null?void 0:u[a])==null?void 0:e[1])!=null?t:null;if(d==null&&l!==1)return console.warn(`Tried to add a material alpha bind to the material ${(n=i.name)!=null?n:"(no name)"}, the type ${a} but the material or the type does not support alpha.`),null;if(d==null)return null;const f=i[d],m=l-f;return{propertyName:d,initialValue:f,deltaValue:m}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(qr._propertyNameMapMap).find(([n])=>this.material[n]===!0))==null?void 0:e[1])!=null?t:null}};_VRMExpressionMaterialColorBind._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var VRMExpressionMaterialColorBind=_VRMExpressionMaterialColorBind,VRMExpressionMorphTargetBind=class{constructor({primitives:r,index:e,weight:t}){this.primitives=r,this.index=e,this.weight=t}applyWeight(r){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*r)})}clearAppliedWeight(){this.primitives.forEach(r=>{var e;((e=r.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(r.morphTargetInfluences[this.index]=0)})}},_v2=new Vector2,_VRMExpressionTextureTransformBind=class Xr{constructor({material:e,scale:t,offset:n}){var i,a;this.material=e,this.scale=t,this.offset=n;const l=(i=Object.entries(Xr._propertyNamesMap).find(([u])=>e[u]===!0))==null?void 0:i[1];l==null?(console.warn(`Tried to add a texture transform bind to the material ${(a=e.name)!=null?a:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],l.forEach(u=>{var d;const f=(d=e[u])==null?void 0:d.clone();if(!f)return null;e[u]=f;const m=f.offset.clone(),s=f.repeat.clone(),o=n.clone().sub(m),c=t.clone().sub(s);this._properties.push({name:u,initialOffset:m,deltaOffset:o,initialScale:s,deltaScale:c})}))}applyWeight(e){this._properties.forEach(t=>{const n=this.material[t.name];n!==void 0&&(n.offset.add(_v2.copy(t.deltaOffset).multiplyScalar(e)),n.repeat.add(_v2.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};_VRMExpressionTextureTransformBind._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var VRMExpressionTextureTransformBind=_VRMExpressionTextureTransformBind,POSSIBLE_SPEC_VERSIONS=new Set(["1.0","1.0-beta"]),_VRMExpressionLoaderPlugin=class Yr{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return __async2(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return __async2(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const n=yield this._v0Import(e);return n||null})}_v1Import(e){return __async2(this,null,function*(){var t,n;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const l=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(!l)return null;const u=l.specVersion;if(!POSSIBLE_SPEC_VERSIONS.has(u))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${u}"`),null;const d=l.expressions;if(!d)return null;const f=new Set(Object.values(VRMExpressionPresetName)),m=new Map;d.preset!=null&&Object.entries(d.preset).forEach(([o,c])=>{if(c!=null){if(!f.has(o)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${o}" detected. Ignoring the expression`);return}m.set(o,c)}}),d.custom!=null&&Object.entries(d.custom).forEach(([o,c])=>{if(f.has(o)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${o}". Ignoring the expression`);return}m.set(o,c)});const s=new VRMExpressionManager;return yield Promise.all(Array.from(m.entries()).map(o=>__async2(this,[o],function*([c,v]){var y,_,b,x,w,S,T;const E=new VRMExpression(c);if(e.scene.add(E),E.isBinary=(y=v.isBinary)!=null?y:!1,E.overrideBlink=(_=v.overrideBlink)!=null?_:"none",E.overrideLookAt=(b=v.overrideLookAt)!=null?b:"none",E.overrideMouth=(x=v.overrideMouth)!=null?x:"none",(w=v.morphTargetBinds)==null||w.forEach(M=>__async2(this,null,function*(){var P;if(M.node===void 0||M.index===void 0)return;const A=yield gltfExtractPrimitivesFromNode(e,M.node),C=M.index;if(!A.every(D=>Array.isArray(D.morphTargetInfluences)&&C{const A=P.material;A&&(Array.isArray(A)?M.push(...A):M.push(A))}),(S=v.materialColorBinds)==null||S.forEach(P=>__async2(this,null,function*(){M.filter(C=>{var D;const k=(D=this.parser.associations.get(C))==null?void 0:D.materials;return P.material===k}).forEach(C=>{E.addBind(new VRMExpressionMaterialColorBind({material:C,type:P.type,targetValue:new Color().fromArray(P.targetValue),targetAlpha:P.targetValue[3]}))})})),(T=v.textureTransformBinds)==null||T.forEach(P=>__async2(this,null,function*(){M.filter(C=>{var D;const k=(D=this.parser.associations.get(C))==null?void 0:D.materials;return P.material===k}).forEach(C=>{var D,k;E.addBind(new VRMExpressionTextureTransformBind({material:C,offset:new Vector2().fromArray((D=P.offset)!=null?D:[0,0]),scale:new Vector2().fromArray((k=P.scale)!=null?k:[1,1])}))})}))}s.registerExpression(E)}))),s})}_v0Import(e){return __async2(this,null,function*(){var t;const n=this.parser.json,i=(t=n.extensions)==null?void 0:t.VRM;if(!i)return null;const a=i.blendShapeMaster;if(!a)return null;const l=new VRMExpressionManager,u=a.blendShapeGroups;if(!u)return l;const d=new Set;return yield Promise.all(u.map(f=>__async2(this,null,function*(){var m;const s=f.presetName,o=s!=null&&Yr.v0v1PresetNameMap[s]||null,c=o??f.name;if(c==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(d.has(c)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${s} has duplicated entries. Ignoring the expression`);return}d.add(c);const v=new VRMExpression(c);e.scene.add(v),v.isBinary=(m=f.isBinary)!=null?m:!1,f.binds&&f.binds.forEach(_=>__async2(this,null,function*(){var b;if(_.mesh===void 0||_.index===void 0)return;const x=[];(b=n.nodes)==null||b.forEach((S,T)=>{S.mesh===_.mesh&&x.push(T)});const w=_.index;yield Promise.all(x.map(S=>__async2(this,null,function*(){var T;const E=yield gltfExtractPrimitivesFromNode(e,S);if(!E.every(M=>Array.isArray(M.morphTargetInfluences)&&w{if(_.materialName===void 0||_.propertyName===void 0||_.targetValue===void 0)return;const b=[];e.scene.traverse(w=>{if(w.material){const S=w.material;Array.isArray(S)?b.push(...S.filter(T=>(T.name===_.materialName||T.name===_.materialName+" (Outline)")&&b.indexOf(T)===-1)):S.name===_.materialName&&b.indexOf(S)===-1&&b.push(S)}});const x=_.propertyName;b.forEach(w=>{if(x==="_MainTex_ST"){const T=new Vector2(_.targetValue[0],_.targetValue[1]),E=new Vector2(_.targetValue[2],_.targetValue[3]);E.y=1-E.y-T.y,v.addBind(new VRMExpressionTextureTransformBind({material:w,scale:T,offset:E}));return}const S=v0ExpressionMaterialColorMap[x];if(S){v.addBind(new VRMExpressionMaterialColorBind({material:w,type:S,targetValue:new Color().fromArray(_.targetValue),targetAlpha:_.targetValue[3]}));return}console.warn(x+" is not supported")})}),l.registerExpression(v)}))),l})}};_VRMExpressionLoaderPlugin.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var VRMExpressionLoaderPlugin=_VRMExpressionLoaderPlugin,_VRMFirstPerson=class $n{constructor(e,t){this._firstPersonOnlyLayer=$n.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=$n.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(t=>({meshes:t.meshes.concat(),type:t.type})),this}clone(){return new $n(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=$n.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=$n.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach(n=>{n.meshes.forEach(i=>{n.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(a=>a.layers.set(this._firstPersonOnlyLayer))):n.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(a=>a.layers.set(this._thirdPersonOnlyLayer))):n.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,n,i){let a=0;if(t!=null&&t.length>0)for(let l=0;l0&&i.includes(s[0])||m[1]>0&&i.includes(s[1])||m[2]>0&&i.includes(s[2])||m[3]>0&&i.includes(s[3]))continue;const o=t[d],c=n[d];if(o[0]>0&&i.includes(c[0])||o[1]>0&&i.includes(c[1])||o[2]>0&&i.includes(c[2])||o[3]>0&&i.includes(c[3]))continue;const v=t[f],y=n[f];v[0]>0&&i.includes(y[0])||v[1]>0&&i.includes(y[1])||v[2]>0&&i.includes(y[2])||v[3]>0&&i.includes(y[3])||(e[a++]=u,e[a++]=d,e[a++]=f)}return a}_createErasedMesh(e,t){const n=new SkinnedMesh(e.geometry.clone(),e.material);n.name=`${e.name}(erase)`,n.frustumCulled=e.frustumCulled,n.layers.set(this._firstPersonOnlyLayer);const i=n.geometry,a=i.getAttribute("skinIndex"),l=a instanceof GLBufferAttribute?[]:a.array,u=[];for(let y=0;y{this._isEraseTarget(a)&&n.push(l)}),!n.length){t.layers.enable(this._thirdPersonOnlyLayer),t.layers.enable(this._firstPersonOnlyLayer);return}t.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(t,n);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer));else{const t=new Group;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(n=>n.type==="SkinnedMesh").forEach(n=>{const i=n;this._createHeadlessModelForSkinnedMesh(t,i)})}else if(e.type==="SkinnedMesh"){const t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};_VRMFirstPerson.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;_VRMFirstPerson.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var VRMFirstPerson=_VRMFirstPerson,POSSIBLE_SPEC_VERSIONS2=new Set(["1.0","1.0-beta"]),VRMFirstPersonLoaderPlugin=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(r){this.parser=r}afterRoot(r){return __async2(this,null,function*(){const e=r.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");r.userData.vrmFirstPerson=yield this._import(r,e)}})}_import(r,e){return __async2(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(r,e);if(t)return t;const n=yield this._v0Import(r,e);return n||null})}_v1Import(r,e){return __async2(this,null,function*(){var t,n;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const l=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(!l)return null;const u=l.specVersion;if(!POSSIBLE_SPEC_VERSIONS2.has(u))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${u}"`),null;const d=l.firstPerson,f=[],m=yield gltfExtractPrimitivesFromNodes(r);return Array.from(m.entries()).forEach(([s,o])=>{var c,v;const y=(c=d==null?void 0:d.meshAnnotations)==null?void 0:c.find(_=>_.node===s);f.push({meshes:o,type:(v=y==null?void 0:y.type)!=null?v:"auto"})}),new VRMFirstPerson(e,f)})}_v0Import(r,e){return __async2(this,null,function*(){var t;const n=this.parser.json,i=(t=n.extensions)==null?void 0:t.VRM;if(!i)return null;const a=i.firstPerson;if(!a)return null;const l=[],u=yield gltfExtractPrimitivesFromNodes(r);return Array.from(u.entries()).forEach(([d,f])=>{const m=n.nodes[d],s=a.meshAnnotations?a.meshAnnotations.find(o=>o.mesh===m.mesh):void 0;l.push({meshes:f,type:this._convertV0FlagToV1Type(s==null?void 0:s.firstPersonFlag)})}),new VRMFirstPerson(e,l)})}_convertV0FlagToV1Type(r){return r==="FirstPersonOnly"?"firstPersonOnly":r==="ThirdPersonOnly"?"thirdPersonOnly":r==="Both"?"both":"auto"}},_v3A=new Vector3,_v3B=new Vector3,_quatA=new Quaternion,VRMHumanoidHelper=class extends Group{constructor(r){super(),this.vrmHumanoid=r,this._boneAxesMap=new Map,Object.values(r.humanBones).forEach(e=>{const t=new AxesHelper(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(r=>{r.geometry.dispose(),r.material.dispose()})}updateMatrixWorld(r){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(_v3A,_quatA,_v3B);const n=_v3A.set(.1,.1,.1).divide(_v3B);t.matrix.copy(e.node.matrixWorld).scale(n)}),super.updateMatrixWorld(r)}},VRMHumanBoneList=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],VRMHumanBoneParentMap={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function quatInvertCompat(r){return r.invert?r.invert():r.inverse(),r}var _v3A2=new Vector3,_quatA2=new Quaternion,VRMRig=class{constructor(r){this.humanBones=r,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const r={};return Object.keys(this.humanBones).forEach(e=>{const t=e,n=this.getBoneNode(t);n&&(_v3A2.copy(n.position),_quatA2.copy(n.quaternion),r[t]={position:_v3A2.toArray(),rotation:_quatA2.toArray()})}),r}getPose(){const r={};return Object.keys(this.humanBones).forEach(e=>{const t=e,n=this.getBoneNode(t);if(!n)return;_v3A2.set(0,0,0),_quatA2.identity();const i=this.restPose[t];i!=null&&i.position&&_v3A2.fromArray(i.position).negate(),i!=null&&i.rotation&&quatInvertCompat(_quatA2.fromArray(i.rotation)),_v3A2.add(n.position),_quatA2.premultiply(n.quaternion),r[t]={position:_v3A2.toArray(),rotation:_quatA2.toArray()}}),r}setPose(r){Object.entries(r).forEach(([e,t])=>{const n=e,i=this.getBoneNode(n);if(!i)return;const a=this.restPose[n];a&&(t!=null&&t.position&&(i.position.fromArray(t.position),a.position&&i.position.add(_v3A2.fromArray(a.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),a.rotation&&i.quaternion.multiply(_quatA2.fromArray(a.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([r,e])=>{const t=this.getBoneNode(r);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(r){var e;return(e=this.humanBones[r])!=null?e:void 0}getBoneNode(r){var e,t;return(t=(e=this.humanBones[r])==null?void 0:e.node)!=null?t:null}},_v3A3=new Vector3,_quatA3=new Quaternion,_boneWorldPos=new Vector3,VRMHumanoidRig=class Kr extends VRMRig{static _setupTransforms(e){const t=new Object3D;t.name="VRMHumanoidRig";const n={},i={},a={};VRMHumanBoneList.forEach(u=>{var d;const f=e.getBoneNode(u);if(f){const m=new Vector3,s=new Quaternion;f.updateWorldMatrix(!0,!1),f.matrixWorld.decompose(m,s,_v3A3),n[u]=m,i[u]=f.quaternion.clone();const o=new Quaternion;(d=f.parent)==null||d.matrixWorld.decompose(_v3A3,o,_v3A3),a[u]=o}});const l={};return VRMHumanBoneList.forEach(u=>{var d;const f=e.getBoneNode(u);if(f){const m=n[u];let s=u,o;for(;o==null&&(s=VRMHumanBoneParentMap[s],s!=null);)o=n[s];const c=new Object3D;c.name="Normalized_"+f.name,(s?(d=l[s])==null?void 0:d.node:t).add(c),c.position.copy(m),o&&c.position.sub(o),l[u]={node:c}}}),{rigBones:l,root:t,parentWorldRotations:a,boneRotations:i}}constructor(e){const{rigBones:t,root:n,parentWorldRotations:i,boneRotations:a}=Kr._setupTransforms(e);super(t),this.original=e,this.root=n,this._parentWorldRotations=i,this._boneRotations=a}update(){VRMHumanBoneList.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const n=this.getBoneNode(e),i=this._parentWorldRotations[e],a=_quatA3.copy(i).invert(),l=this._boneRotations[e];if(t.quaternion.copy(n.quaternion).multiply(i).premultiply(a).multiply(l),e==="hips"){const u=n.getWorldPosition(_boneWorldPos);t.parent.updateWorldMatrix(!0,!1);const d=t.parent.matrixWorld,f=u.applyMatrix4(d.invert());t.position.copy(f)}}})}},VRMHumanoid=class Qr{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var n;this.autoUpdateHumanBones=(n=t==null?void 0:t.autoUpdateHumanBones)!=null?n:!0,this._rawHumanBones=new VRMRig(e),this._normalizedHumanBones=new VRMHumanoidRig(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new VRMRig(e.humanBones),this._normalizedHumanBones=new VRMHumanoidRig(this._rawHumanBones),this}clone(){return new Qr(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},VRMRequiredHumanBoneName={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},POSSIBLE_SPEC_VERSIONS3=new Set(["1.0","1.0-beta"]),thumbBoneNameMap={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},VRMHumanoidLoaderPlugin=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(r,e){this.parser=r,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(r){return __async2(this,null,function*(){r.userData.vrmHumanoid=yield this._import(r)})}_import(r){return __async2(this,null,function*(){const e=yield this._v1Import(r);if(e)return e;const t=yield this._v0Import(r);return t||null})}_v1Import(r){return __async2(this,null,function*(){var e,t;const n=this.parser.json;if(!(((e=n.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const a=(t=n.extensions)==null?void 0:t.VRMC_vrm;if(!a)return null;const l=a.specVersion;if(!POSSIBLE_SPEC_VERSIONS3.has(l))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${l}"`),null;const u=a.humanoid;if(!u)return null;const d=u.humanBones.leftThumbIntermediate!=null||u.humanBones.rightThumbIntermediate!=null,f={};u.humanBones!=null&&(yield Promise.all(Object.entries(u.humanBones).map(s=>__async2(this,[s],function*([o,c]){let v=o;const y=c.node;if(d){const b=thumbBoneNameMap[v];b!=null&&(v=b)}const _=yield this.parser.getDependency("node",y);if(_==null){console.warn(`A glTF node bound to the humanoid bone ${v} (index = ${y}) does not exist`);return}f[v]={node:_}}))));const m=new VRMHumanoid(this._ensureRequiredBonesExist(f),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(r.scene.add(m.normalizedHumanBonesRoot),this.helperRoot){const s=new VRMHumanoidHelper(m);this.helperRoot.add(s),s.renderOrder=this.helperRoot.renderOrder}return m})}_v0Import(r){return __async2(this,null,function*(){var e;const n=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!n)return null;const i=n.humanoid;if(!i)return null;const a={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(u=>__async2(this,null,function*(){const d=u.bone,f=u.node;if(d==null||f==null)return;const m=yield this.parser.getDependency("node",f);if(m==null){console.warn(`A glTF node bound to the humanoid bone ${d} (index = ${f}) does not exist`);return}const s=thumbBoneNameMap[d],o=s??d;if(a[o]!=null){console.warn(`Multiple bone entries for ${o} detected (index = ${f}), ignoring duplicated entries.`);return}a[o]={node:m}}))));const l=new VRMHumanoid(this._ensureRequiredBonesExist(a),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(r.scene.add(l.normalizedHumanBonesRoot),this.helperRoot){const u=new VRMHumanoidHelper(l);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return l})}_ensureRequiredBonesExist(r){const e=Object.values(VRMRequiredHumanBoneName).filter(t=>r[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return r}},FanBufferGeometry=class extends BufferGeometry{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new BufferAttribute(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new BufferAttribute(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,r=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,r=!0),r&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let r=0;r<64;r++){const e=r/63*this._currentTheta;this._attrPos.setXYZ(r+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let r=0;r<63;r++)this._attrIndex.setXYZ(r*3,0,r+1,r+2);this._attrIndex.needsUpdate=!0}},LineAndSphereBufferGeometry=class extends BufferGeometry{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new Vector3,this._currentTail=new Vector3,this._attrPos=new BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,r=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),r=!0),r&&this._buildPosition()}_buildPosition(){for(let r=0;r<32;r++){const e=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+r,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+r,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let r=0;r<32;r++){const e=(r+1)%32;this._attrIndex.setXY(r*2,r,e),this._attrIndex.setXY(64+r*2,32+r,32+e),this._attrIndex.setXY(128+r*2,64+r,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},_quatA4=new Quaternion,_quatB=new Quaternion,_v3A4=new Vector3,_v3B2=new Vector3,SQRT_2_OVER_2=Math.sqrt(2)/2,QUAT_XY_CW90=new Quaternion(0,0,-SQRT_2_OVER_2,SQRT_2_OVER_2),VEC3_POSITIVE_Y=new Vector3(0,1,0),VRMLookAtHelper=class extends Group{constructor(r){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=r;{const e=new FanBufferGeometry;e.radius=.5;const t=new MeshBasicMaterial({color:65280,transparent:!0,opacity:.5,side:DoubleSide,depthTest:!1,depthWrite:!1});this._meshPitch=new Mesh(e,t),this.add(this._meshPitch)}{const e=new FanBufferGeometry;e.radius=.5;const t=new MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5,side:DoubleSide,depthTest:!1,depthWrite:!1});this._meshYaw=new Mesh(e,t),this.add(this._meshYaw)}{const e=new LineAndSphereBufferGeometry;e.radius=.1;const t=new LineBasicMaterial({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new LineSegments(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(r){const e=MathUtils.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=MathUtils.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(_v3A4),this.vrmLookAt.getLookAtWorldQuaternion(_quatA4),_quatA4.multiply(this.vrmLookAt.getFaceFrontQuaternion(_quatB)),this._meshYaw.position.copy(_v3A4),this._meshYaw.quaternion.copy(_quatA4),this._meshPitch.position.copy(_v3A4),this._meshPitch.quaternion.copy(_quatA4),this._meshPitch.quaternion.multiply(_quatB.setFromAxisAngle(VEC3_POSITIVE_Y,e)),this._meshPitch.quaternion.multiply(QUAT_XY_CW90);const{target:n,autoUpdate:i}=this.vrmLookAt;n!=null&&i&&(n.getWorldPosition(_v3B2).sub(_v3A4),this._lineTarget.geometry.tail.copy(_v3B2),this._lineTarget.geometry.update(),this._lineTarget.position.copy(_v3A4)),super.updateMatrixWorld(r)}},_position=new Vector3,_scale=new Vector3;function getWorldQuaternionLite(r,e){return r.matrixWorld.decompose(_position,e,_scale),e}function calcAzimuthAltitude(r){return[Math.atan2(-r.z,r.x),Math.atan2(r.y,Math.sqrt(r.x*r.x+r.z*r.z))]}function sanitizeAngle(r){const e=Math.round(r/2/Math.PI);return r-2*Math.PI*e}var VEC3_POSITIVE_Z=new Vector3(0,0,1),_v3A5=new Vector3,_v3B3=new Vector3,_v3C=new Vector3,_quatA5=new Quaternion,_quatB2=new Quaternion,_quatC=new Quaternion,_quatD=new Quaternion,_eulerA=new Euler,_VRMLookAt=class Jr{constructor(e,t){this.offsetFromHeadBone=new Vector3,this.autoUpdate=!0,this.faceFront=new Vector3(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new Quaternion)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new Euler)}getEuler(e){return e.set(MathUtils.DEG2RAD*this._pitch,MathUtils.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new Jr(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getRawBoneNode("head");return getWorldQuaternionLite(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(VEC3_POSITIVE_Z)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,n]=calcAzimuthAltitude(this.faceFront);return _eulerA.set(0,.5*Math.PI+t,n,"YZX"),e.setFromEuler(_eulerA).premultiply(_quatD.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(_quatB2),this.getFaceFrontQuaternion(_quatC),e.copy(VEC3_POSITIVE_Z).applyQuaternion(_quatB2).applyQuaternion(_quatC).applyEuler(this.getEuler(_eulerA))}lookAt(e){const t=_quatA5.copy(this._restHeadWorldQuaternion).multiply(quatInvertCompat(this.getLookAtWorldQuaternion(_quatB2))),n=this.getLookAtWorldPosition(_v3B3),i=_v3C.copy(e).sub(n).applyQuaternion(t).normalize(),[a,l]=calcAzimuthAltitude(this.faceFront),[u,d]=calcAzimuthAltitude(i),f=sanitizeAngle(u-a),m=sanitizeAngle(l-d);this._yaw=MathUtils.RAD2DEG*f,this._pitch=MathUtils.RAD2DEG*m,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(_v3A5)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};_VRMLookAt.EULER_ORDER="YXZ";var VRMLookAt=_VRMLookAt,VEC3_POSITIVE_Z2=new Vector3(0,0,1),_quatA6=new Quaternion,_quatB3=new Quaternion,_eulerA2=new Euler(0,0,0,"YXZ"),VRMLookAtBoneApplier=class{constructor(r,e,t,n,i){this.humanoid=r,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=n,this.rangeMapVerticalUp=i,this.faceFront=new Vector3(0,0,1),this._restQuatLeftEye=new Quaternion,this._restQuatRightEye=new Quaternion,this._restLeftEyeParentWorldQuat=new Quaternion,this._restRightEyeParentWorldQuat=new Quaternion;const a=this.humanoid.getRawBoneNode("leftEye"),l=this.humanoid.getRawBoneNode("rightEye");a&&(this._restQuatLeftEye.copy(a.quaternion),getWorldQuaternionLite(a.parent,this._restLeftEyeParentWorldQuat)),l&&(this._restQuatRightEye.copy(l.quaternion),getWorldQuaternionLite(l.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(r,e){const t=this.humanoid.getRawBoneNode("leftEye"),n=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),a=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?_eulerA2.x=-MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-e):_eulerA2.x=MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(e),r<0?_eulerA2.y=-MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(-r):_eulerA2.y=MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(r),_quatA6.setFromEuler(_eulerA2),this._getWorldFaceFrontQuat(_quatB3),i.quaternion.copy(_quatB3).multiply(_quatA6).multiply(_quatB3.invert()),_quatA6.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(_quatA6).premultiply(_quatA6.invert()).multiply(this._restQuatLeftEye)),n&&(e<0?_eulerA2.x=-MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-e):_eulerA2.x=MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(e),r<0?_eulerA2.y=-MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(-r):_eulerA2.y=MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(r),_quatA6.setFromEuler(_eulerA2),this._getWorldFaceFrontQuat(_quatB3),a.quaternion.copy(_quatB3).multiply(_quatA6).multiply(_quatB3.invert()),_quatA6.copy(this._restRightEyeParentWorldQuat),n.quaternion.copy(a.quaternion).multiply(_quatA6).premultiply(_quatA6.invert()).multiply(this._restQuatRightEye))}lookAt(r){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=MathUtils.RAD2DEG*r.y,t=MathUtils.RAD2DEG*r.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(r){if(this.faceFront.distanceToSquared(VEC3_POSITIVE_Z2)<.01)return r.identity();const[e,t]=calcAzimuthAltitude(this.faceFront);return _eulerA2.set(0,.5*Math.PI+e,t,"YZX"),r.setFromEuler(_eulerA2)}};VRMLookAtBoneApplier.type="bone";var VRMLookAtExpressionApplier=class{constructor(r,e,t,n,i){this.expressions=r,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=n,this.rangeMapVerticalUp=i}applyYawPitch(r,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),r<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-r))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(r)))}lookAt(r){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=MathUtils.RAD2DEG*r.y,t=MathUtils.RAD2DEG*r.x;this.applyYawPitch(e,t)}};VRMLookAtExpressionApplier.type="expression";var VRMLookAtRangeMap=class{constructor(r,e){this.inputMaxValue=r,this.outputScale=e}map(r){return this.outputScale*saturate(r/this.inputMaxValue)}},POSSIBLE_SPEC_VERSIONS4=new Set(["1.0","1.0-beta"]),INPUT_MAX_VALUE_MINIMUM=.01,VRMLookAtLoaderPlugin=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(r,e){this.parser=r,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(r){return __async2(this,null,function*(){const e=r.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=r.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");r.userData.vrmLookAt=yield this._import(r,e,t)}})}_import(r,e,t){return __async2(this,null,function*(){if(e==null||t==null)return null;const n=yield this._v1Import(r,e,t);if(n)return n;const i=yield this._v0Import(r,e,t);return i||null})}_v1Import(r,e,t){return __async2(this,null,function*(){var n,i,a;const l=this.parser.json;if(!(((n=l.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const d=(i=l.extensions)==null?void 0:i.VRMC_vrm;if(!d)return null;const f=d.specVersion;if(!POSSIBLE_SPEC_VERSIONS4.has(f))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${f}"`),null;const m=d.lookAt;if(!m)return null;const s=m.type==="expression"?1:10,o=this._v1ImportRangeMap(m.rangeMapHorizontalInner,s),c=this._v1ImportRangeMap(m.rangeMapHorizontalOuter,s),v=this._v1ImportRangeMap(m.rangeMapVerticalDown,s),y=this._v1ImportRangeMap(m.rangeMapVerticalUp,s);let _;m.type==="expression"?_=new VRMLookAtExpressionApplier(t,o,c,v,y):_=new VRMLookAtBoneApplier(e,o,c,v,y);const b=this._importLookAt(e,_);return b.offsetFromHeadBone.fromArray((a=m.offsetFromHeadBone)!=null?a:[0,.06,0]),b})}_v1ImportRangeMap(r,e){var t,n;let i=(t=r==null?void 0:r.inputMaxValue)!=null?t:90;const a=(n=r==null?void 0:r.outputScale)!=null?n:e;return i(console.error(l),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},VRMCore=class{constructor(r){this.scene=r.scene,this.meta=r.meta,this.humanoid=r.humanoid,this.expressionManager=r.expressionManager,this.firstPerson=r.firstPerson,this.lookAt=r.lookAt}update(r){this.humanoid.update(),this.lookAt&&this.lookAt.update(r),this.expressionManager&&this.expressionManager.update()}},VRM=class extends VRMCore{constructor(r){super(r),this.materials=r.materials,this.springBoneManager=r.springBoneManager,this.nodeConstraintManager=r.nodeConstraintManager}update(r){super.update(r),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(r),this.materials&&this.materials.forEach(e=>{e.update&&e.update(r)})}},__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,e,t)=>e in r?__defProp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,__spreadValues=(r,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(r,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(r,t,e[t]);return r},__async3=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),colorSpaceEncodingMap={"":3e3,srgb:3001};function setTextureColorSpace(r,e){parseInt(REVISION,10)>=152?r.colorSpace=e:r.encoding=colorSpaceEncodingMap[e]}var GLTFMToonMaterialParamsAssignHelper=class{get pending(){return Promise.all(this._pendings)}constructor(r,e){this._parser=r,this._materialParams=e,this._pendings=[]}assignPrimitive(r,e){e!=null&&(this._materialParams[r]=e)}assignColor(r,e,t){e!=null&&(this._materialParams[r]=new Color().fromArray(e),t&&this._materialParams[r].convertSRGBToLinear())}assignTexture(r,e,t){return __async3(this,null,function*(){const n=__async3(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,r,e),t&&setTextureColorSpace(this._materialParams[r],"srgb"))});return this._pendings.push(n),n})}assignTextureByIndex(r,e,t){return __async3(this,null,function*(){return this.assignTexture(r,e!=null?{index:e}:void 0,t)})}},mtoon_default=`// #define PHONG - -varying vec3 vViewPosition; - -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif - -#include - -// #include -#ifdef MTOON_USE_UV - varying vec2 vUv; - - // COMPAT: pre-r151 uses a common uvTransform - #if THREE_VRM_THREE_REVISION < 151 - uniform mat3 uvTransform; - #endif -#endif - -// #include -// COMAPT: pre-r151 uses uv2 for lightMap and aoMap -#if THREE_VRM_THREE_REVISION < 151 - #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - attribute vec2 uv2; - varying vec2 vUv2; - uniform mat3 uv2Transform; - #endif -#endif - -// #include -// #include -#include -#include -#include -#include -#include -#include -#include - -#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE - uniform sampler2D outlineWidthMultiplyTexture; - uniform mat3 outlineWidthMultiplyTextureUvTransform; -#endif - -uniform float outlineWidthFactor; - -void main() { - - // #include - #ifdef MTOON_USE_UV - // COMPAT: pre-r151 uses a common uvTransform - #if THREE_VRM_THREE_REVISION >= 151 - vUv = uv; - #else - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #endif - - // #include - // COMAPT: pre-r151 uses uv2 for lightMap and aoMap - #if THREE_VRM_THREE_REVISION < 151 - #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; - #endif - #endif - - #include - - #include - #include - #include - #include - - // we need this to compute the outline properly - objectNormal = normalize( objectNormal ); - - #include - - #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED - vNormal = normalize( transformedNormal ); - #endif - - #include - - #include - #include - // #include - #include - #include - #include - - vViewPosition = - mvPosition.xyz; - - #ifdef OUTLINE - float worldNormalLength = length( transformedNormal ); - vec3 outlineOffset = outlineWidthFactor * worldNormalLength * objectNormal; - - #ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE - vec2 outlineWidthMultiplyTextureUv = ( outlineWidthMultiplyTextureUvTransform * vec3( vUv, 1 ) ).xy; - float outlineTex = texture2D( outlineWidthMultiplyTexture, outlineWidthMultiplyTextureUv ).g; - outlineOffset *= outlineTex; - #endif - - #ifdef OUTLINE_WIDTH_SCREEN - outlineOffset *= vViewPosition.z / projectionMatrix[ 1 ].y; - #endif - - gl_Position = projectionMatrix * modelViewMatrix * vec4( outlineOffset + transformed, 1.0 ); - - gl_Position.z += 1E-6 * gl_Position.w; // anti-artifact magic - #endif - - #include - // #include - #include - #include - -}`,mtoon_default2=`// #define PHONG - -uniform vec3 litFactor; - -uniform float opacity; - -uniform vec3 shadeColorFactor; -#ifdef USE_SHADEMULTIPLYTEXTURE - uniform sampler2D shadeMultiplyTexture; - uniform mat3 shadeMultiplyTextureUvTransform; -#endif - -uniform float shadingShiftFactor; -uniform float shadingToonyFactor; - -#ifdef USE_SHADINGSHIFTTEXTURE - uniform sampler2D shadingShiftTexture; - uniform mat3 shadingShiftTextureUvTransform; - uniform float shadingShiftTextureScale; -#endif - -uniform float giEqualizationFactor; - -uniform vec3 parametricRimColorFactor; -#ifdef USE_RIMMULTIPLYTEXTURE - uniform sampler2D rimMultiplyTexture; - uniform mat3 rimMultiplyTextureUvTransform; -#endif -uniform float rimLightingMixFactor; -uniform float parametricRimFresnelPowerFactor; -uniform float parametricRimLiftFactor; - -#ifdef USE_MATCAPTEXTURE - uniform vec3 matcapFactor; - uniform sampler2D matcapTexture; - uniform mat3 matcapTextureUvTransform; -#endif - -uniform vec3 emissive; -uniform float emissiveIntensity; - -uniform vec3 outlineColorFactor; -uniform float outlineLightingMixFactor; - -#ifdef USE_UVANIMATIONMASKTEXTURE - uniform sampler2D uvAnimationMaskTexture; - uniform mat3 uvAnimationMaskTextureUvTransform; -#endif - -uniform float uvAnimationScrollXOffset; -uniform float uvAnimationScrollYOffset; -uniform float uvAnimationRotationPhase; - -#include -#include -#include -#include - -// #include -#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) ) - varying vec2 vUv; -#endif - -// #include -// COMAPT: pre-r151 uses uv2 for lightMap and aoMap -#if THREE_VRM_THREE_REVISION < 151 - #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - varying vec2 vUv2; - #endif -#endif - -#include - -#ifdef USE_MAP - uniform mat3 mapUvTransform; -#endif - -// #include - -#include - -#include -// #include -#include - -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapUvTransform; -#endif - -// #include -// #include -// #include -#include - -// #include -// COMPAT: pre-r151 doesn't have BRDF_Lambert in -#if THREE_VRM_THREE_REVISION < 151 - vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; - } -#endif - -#include - -#include - -// #include -varying vec3 vViewPosition; - -struct MToonMaterial { - vec3 diffuseColor; - vec3 shadeColor; - float shadingShift; -}; - -float linearstep( float a, float b, float t ) { - return clamp( ( t - a ) / ( b - a ), 0.0, 1.0 ); -} - -/** - * Convert NdotL into toon shading factor using shadingShift and shadingToony - */ -float getShading( - const in float dotNL, - const in float shadow, - const in float shadingShift -) { - float shading = dotNL; - shading = shading + shadingShift; - shading = linearstep( -1.0 + shadingToonyFactor, 1.0 - shadingToonyFactor, shading ); - shading *= shadow; - return shading; -} - -/** - * Mix diffuseColor and shadeColor using shading factor and light color - */ -vec3 getDiffuse( - const in MToonMaterial material, - const in float shading, - in vec3 lightColor -) { - #ifdef DEBUG_LITSHADERATE - return vec3( BRDF_Lambert( shading * lightColor ) ); - #endif - - vec3 col = lightColor * BRDF_Lambert( mix( material.shadeColor, material.diffuseColor, shading ) ); - - // The "comment out if you want to PBR absolutely" line - #ifdef V0_COMPAT_SHADE - col = min( col, material.diffuseColor ); - #endif - - return col; -} - -// COMPAT: pre-r156 uses a struct GeometricContext -#if THREE_VRM_THREE_REVISION >= 157 - void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) { - float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 ); - vec3 irradiance = directLight.color; - - // directSpecular will be used for rim lighting, not an actual specular - reflectedLight.directSpecular += irradiance; - - irradiance *= dotNL; - - float shading = getShading( dotNL, shadow, material.shadingShift ); - - // toon shaded diffuse - reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color ); - } - - void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, inout ReflectedLight reflectedLight ) { - // indirect diffuse will use diffuseColor, no shadeColor involved - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - - // directSpecular will be used for rim lighting, not an actual specular - reflectedLight.directSpecular += irradiance; - } -#else - void RE_Direct_MToon( const in IncidentLight directLight, const in GeometricContext geometry, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) { - float dotNL = clamp( dot( geometry.normal, directLight.direction ), -1.0, 1.0 ); - vec3 irradiance = directLight.color; - - // directSpecular will be used for rim lighting, not an actual specular - reflectedLight.directSpecular += irradiance; - - irradiance *= dotNL; - - float shading = getShading( dotNL, shadow, material.shadingShift ); - - // toon shaded diffuse - reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color ); - } - - void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in GeometricContext geometry, const in MToonMaterial material, inout ReflectedLight reflectedLight ) { - // indirect diffuse will use diffuseColor, no shadeColor involved - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - - // directSpecular will be used for rim lighting, not an actual specular - reflectedLight.directSpecular += irradiance; - } -#endif - -#define RE_Direct RE_Direct_MToon -#define RE_IndirectDiffuse RE_IndirectDiffuse_MToon -#define Material_LightProbeLOD( material ) (0) - -#include -// #include - -// #include -#ifdef USE_NORMALMAP - - uniform sampler2D normalMap; - uniform mat3 normalMapUvTransform; - uniform vec2 normalScale; - -#endif - -// COMPAT: pre-r151 -// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151 -#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP ) - - uniform mat3 normalMatrix; - -#endif - -// COMPAT: pre-r151 -// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151 -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( TANGENTSPACE_NORMALMAP ) ) - - // Per-Pixel Tangent Space Normal Mapping - // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html - - // three-vrm specific change: it requires \`uv\` as an input in order to support uv scrolls - - // Temporary compat against shader change @ Three.js r126, r151 - #if THREE_VRM_THREE_REVISION >= 151 - - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - - vec3 N = surf_norm; - - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - - return mat3( T * scale, B * scale, N ); - - } - - #else - - vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { - - vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); - vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - - vec3 N = normalize( surf_norm ); - - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - - // three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0 - // TODO: Is this still required? Or shall I make a PR about it? - if ( length( T ) == 0.0 || length( B ) == 0.0 ) { - return surf_norm; - } - - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); - - return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); - - } - - #endif - -#endif - -// #include -#include -#include - -// == post correction ========================================================== -void postCorrection() { - #include - #include - #include - #include - #include -} - -// == main procedure =========================================================== -void main() { - #include - - vec2 uv = vec2(0.5, 0.5); - - #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) ) - uv = vUv; - - float uvAnimMask = 1.0; - #ifdef USE_UVANIMATIONMASKTEXTURE - vec2 uvAnimationMaskTextureUv = ( uvAnimationMaskTextureUvTransform * vec3( uv, 1 ) ).xy; - uvAnimMask = texture2D( uvAnimationMaskTexture, uvAnimationMaskTextureUv ).b; - #endif - - float uvRotCos = cos( uvAnimationRotationPhase * uvAnimMask ); - float uvRotSin = sin( uvAnimationRotationPhase * uvAnimMask ); - uv = mat2( uvRotCos, -uvRotSin, uvRotSin, uvRotCos ) * ( uv - 0.5 ) + 0.5; - uv = uv + vec2( uvAnimationScrollXOffset, uvAnimationScrollYOffset ) * uvAnimMask; - #endif - - #ifdef DEBUG_UV - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) ) - gl_FragColor = vec4( uv, 0.0, 1.0 ); - #endif - return; - #endif - - vec4 diffuseColor = vec4( litFactor, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive * emissiveIntensity; - - #include - - // #include - #ifdef USE_MAP - vec2 mapUv = ( mapUvTransform * vec3( uv, 1 ) ).xy; - vec4 sampledDiffuseColor = texture2D( map, mapUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); - #endif - diffuseColor *= sampledDiffuseColor; - #endif - - // #include - #if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) ) - diffuseColor.rgb *= vColor; - #endif - - // #include - - #include - - // #include - - // #include - float faceDirection = gl_FrontFacing ? 1.0 : -1.0; - - #ifdef FLAT_SHADED - - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); - - #else - - vec3 normal = normalize( vNormal ); - - #ifdef DOUBLE_SIDED - - normal *= faceDirection; - - #endif - - #endif - - #ifdef USE_NORMALMAP - - vec2 normalMapUv = ( normalMapUvTransform * vec3( uv, 1 ) ).xy; - - #endif - - #ifdef USE_NORMALMAP_TANGENTSPACE - - #ifdef USE_TANGENT - - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - - #else - - mat3 tbn = getTangentFrame( - vViewPosition, normal, normalMapUv ); - - #endif - - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - - #endif - - #endif - - #ifdef USE_CLEARCOAT_NORMALMAP - - #ifdef USE_TANGENT - - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - - #else - - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - - #endif - - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - - #endif - - #endif - - // non perturbed normal for clearcoat among others - - vec3 nonPerturbedNormal = normal; - - #ifdef OUTLINE - normal *= -1.0; - #endif - - // #include - - // COMPAT: pre-r151 - // USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151 - #if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP ) - - normal = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals - - #ifdef FLIP_SIDED - - normal = - normal; - - #endif - - #ifdef DOUBLE_SIDED - - normal = normal * faceDirection; - - #endif - - normal = normalize( normalMatrix * normal ); - - // COMPAT: pre-r151 - // USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151 - #elif defined( USE_NORMALMAP_TANGENTSPACE ) || defined( TANGENTSPACE_NORMALMAP ) - - vec3 mapN = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - - // COMPAT: pre-r151 - #if THREE_VRM_THREE_REVISION >= 151 || defined( USE_TANGENT ) - - normal = normalize( tbn * mapN ); - - #else - - normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN, faceDirection ); - - #endif - - #endif - - // #include - #ifdef USE_EMISSIVEMAP - vec2 emissiveMapUv = ( emissiveMapUvTransform * vec3( uv, 1 ) ).xy; - totalEmissiveRadiance *= texture2D( emissiveMap, emissiveMapUv ).rgb; - #endif - - #ifdef DEBUG_NORMAL - gl_FragColor = vec4( 0.5 + 0.5 * normal, 1.0 ); - return; - #endif - - // -- MToon: lighting -------------------------------------------------------- - // accumulation - // #include - MToonMaterial material; - - material.diffuseColor = diffuseColor.rgb; - - material.shadeColor = shadeColorFactor; - #ifdef USE_SHADEMULTIPLYTEXTURE - vec2 shadeMultiplyTextureUv = ( shadeMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy; - material.shadeColor *= texture2D( shadeMultiplyTexture, shadeMultiplyTextureUv ).rgb; - #endif - - #if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) ) - material.shadeColor.rgb *= vColor; - #endif - - material.shadingShift = shadingShiftFactor; - #ifdef USE_SHADINGSHIFTTEXTURE - vec2 shadingShiftTextureUv = ( shadingShiftTextureUvTransform * vec3( uv, 1 ) ).xy; - material.shadingShift += texture2D( shadingShiftTexture, shadingShiftTextureUv ).r * shadingShiftTextureScale; - #endif - - // #include - - // MToon Specific changes: - // Since we want to take shadows into account of shading instead of irradiance, - // we had to modify the codes that multiplies the results of shadowmap into color of direct lights. - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - vec3 geometryPosition = - vViewPosition; - vec3 geometryNormal = normal; - vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); - - vec3 geometryClearcoatNormal; - - #ifdef USE_CLEARCOAT - - geometryClearcoatNormal = clearcoatNormal; - - #endif - #else - GeometricContext geometry; - - geometry.position = - vViewPosition; - geometry.normal = normal; - geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); - - #ifdef USE_CLEARCOAT - - geometry.clearcoatNormal = clearcoatNormal; - - #endif - #endif - - IncidentLight directLight; - - // since these variables will be used in unrolled loop, we have to define in prior - float shadow; - - #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - - pointLight = pointLights[ i ]; - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - getPointLightInfo( pointLight, geometryPosition, directLight ); - #else - getPointLightInfo( pointLight, geometry, directLight ); - #endif - - shadow = 1.0; - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - // COMPAT: pre-r166 - // r166 introduced shadowIntensity - #if THREE_VRM_THREE_REVISION >= 166 - shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #else - shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - #endif - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight ); - #else - RE_Direct( directLight, geometry, material, shadow, reflectedLight ); - #endif - - } - #pragma unroll_loop_end - - #endif - - #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - - SpotLight spotLight; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - - spotLight = spotLights[ i ]; - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #else - getSpotLightInfo( spotLight, geometry, directLight ); - #endif - - shadow = 1.0; - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - // COMPAT: pre-r166 - // r166 introduced shadowIntensity - #if THREE_VRM_THREE_REVISION >= 166 - shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; - #else - shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; - #endif - #endif - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight ); - #else - RE_Direct( directLight, geometry, material, shadow, reflectedLight ); - #endif - - } - #pragma unroll_loop_end - - #endif - - #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - - directionalLight = directionalLights[ i ]; - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - getDirectionalLightInfo( directionalLight, directLight ); - #else - getDirectionalLightInfo( directionalLight, geometry, directLight ); - #endif - - shadow = 1.0; - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - // COMPAT: pre-r166 - // r166 introduced shadowIntensity - #if THREE_VRM_THREE_REVISION >= 166 - shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #else - shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - #endif - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight ); - #else - RE_Direct( directLight, geometry, material, shadow, reflectedLight ); - #endif - - } - #pragma unroll_loop_end - - #endif - - // #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - - // RectAreaLight rectAreaLight; - - // #pragma unroll_loop_start - // for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - - // rectAreaLight = rectAreaLights[ i ]; - // RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); - - // } - // #pragma unroll_loop_end - - // #endif - - #if defined( RE_IndirectDiffuse ) - - vec3 iblIrradiance = vec3( 0.0 ); - - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - - // COMPAT: pre-r156 uses a struct GeometricContext - // COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES - #if THREE_VRM_THREE_REVISION >= 157 - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #else - irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); - #endif - - #if ( NUM_HEMI_LIGHTS > 0 ) - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - - // COMPAT: pre-r156 uses a struct GeometricContext - #if THREE_VRM_THREE_REVISION >= 157 - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - #else - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); - #endif - - } - #pragma unroll_loop_end - - #endif - - #endif - - // #if defined( RE_IndirectSpecular ) - - // vec3 radiance = vec3( 0.0 ); - // vec3 clearcoatRadiance = vec3( 0.0 ); - - // #endif - - #include - #include - - // modulation - #include - - vec3 col = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - - #ifdef DEBUG_LITSHADERATE - gl_FragColor = vec4( col, diffuseColor.a ); - postCorrection(); - return; - #endif - - // -- MToon: rim lighting ----------------------------------------- - vec3 viewDir = normalize( vViewPosition ); - - #ifndef PHYSICALLY_CORRECT_LIGHTS - reflectedLight.directSpecular /= PI; - #endif - vec3 rimMix = mix( vec3( 1.0 ), reflectedLight.directSpecular, 1.0 ); - - vec3 rim = parametricRimColorFactor * pow( saturate( 1.0 - dot( viewDir, normal ) + parametricRimLiftFactor ), parametricRimFresnelPowerFactor ); - - #ifdef USE_MATCAPTEXTURE - { - vec3 x = normalize( vec3( viewDir.z, 0.0, -viewDir.x ) ); - vec3 y = cross( viewDir, x ); // guaranteed to be normalized - vec2 sphereUv = 0.5 + 0.5 * vec2( dot( x, normal ), -dot( y, normal ) ); - sphereUv = ( matcapTextureUvTransform * vec3( sphereUv, 1 ) ).xy; - vec3 matcap = texture2D( matcapTexture, sphereUv ).rgb; - rim += matcapFactor * matcap; - } - #endif - - #ifdef USE_RIMMULTIPLYTEXTURE - vec2 rimMultiplyTextureUv = ( rimMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy; - rim *= texture2D( rimMultiplyTexture, rimMultiplyTextureUv ).rgb; - #endif - - col += rimMix * rim; - - // -- MToon: Emission -------------------------------------------------------- - col += totalEmissiveRadiance; - - // #include - - // -- Almost done! ----------------------------------------------------------- - #if defined( OUTLINE ) - col = outlineColorFactor.rgb * mix( vec3( 1.0 ), col, outlineLightingMixFactor ); - #endif - - #ifdef OPAQUE - diffuseColor.a = 1.0; - #endif - - gl_FragColor = vec4( col, diffuseColor.a ); - postCorrection(); -} -`,MToonMaterialDebugMode={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},MToonMaterialOutlineWidthMode={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},encodingColorSpaceMap={3e3:"",3001:"srgb"};function getTextureColorSpace(r){return parseInt(REVISION,10)>=152?r.colorSpace:encodingColorSpaceMap[r.encoding]}var MToonMaterial=class extends ShaderMaterial{constructor(r={}){var e;super({vertexShader:mtoon_default,fragmentShader:mtoon_default2}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=TangentSpaceNormalMap,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=MToonMaterialDebugMode.None,this._outlineWidthMode=MToonMaterialOutlineWidthMode.None,this._isOutline=!1,r.transparentWithZWrite&&(r.depthWrite=!0),delete r.transparentWithZWrite,r.fog=!0,r.lights=!0,r.clipping=!0,this.uniforms=UniformsUtils.merge([UniformsLib.common,UniformsLib.normalmap,UniformsLib.emissivemap,UniformsLib.fog,UniformsLib.lights,{litFactor:{value:new Color(1,1,1)},mapUvTransform:{value:new Matrix3},colorAlpha:{value:1},normalMapUvTransform:{value:new Matrix3},shadeColorFactor:{value:new Color(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new Matrix3},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new Matrix3},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new Color(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new Matrix3},parametricRimColorFactor:{value:new Color(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new Matrix3},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new Color(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new Matrix3},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new Matrix3},outlineWidthFactor:{value:0},outlineColorFactor:{value:new Color(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new Matrix3},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=r.uniforms)!=null?e:{}]),this.setValues(r),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,n])=>`${t}:${n}`),this.matcapTexture?`matcapTextureColorSpace:${getTextureColorSpace(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${getTextureColorSpace(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${getTextureColorSpace(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const n=parseInt(REVISION,10),i=Object.entries(__spreadValues(__spreadValues({},this._generateDefines()),this.defines)).filter(([a,l])=>!!l).map(([a,l])=>`#define ${a} ${l}`).join(` -`)+` -`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,n<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(r){this.uniforms.litFactor.value=r}get map(){return this.uniforms.map.value}set map(r){this.uniforms.map.value=r}get normalMap(){return this.uniforms.normalMap.value}set normalMap(r){this.uniforms.normalMap.value=r}get normalScale(){return this.uniforms.normalScale.value}set normalScale(r){this.uniforms.normalScale.value=r}get emissive(){return this.uniforms.emissive.value}set emissive(r){this.uniforms.emissive.value=r}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(r){this.uniforms.emissiveIntensity.value=r}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(r){this.uniforms.emissiveMap.value=r}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(r){this.uniforms.shadeColorFactor.value=r}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(r){this.uniforms.shadeMultiplyTexture.value=r}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(r){this.uniforms.shadingShiftFactor.value=r}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(r){this.uniforms.shadingShiftTexture.value=r}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(r){this.uniforms.shadingShiftTextureScale.value=r}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(r){this.uniforms.shadingToonyFactor.value=r}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(r){this.uniforms.giEqualizationFactor.value=r}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(r){this.uniforms.matcapFactor.value=r}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(r){this.uniforms.matcapTexture.value=r}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(r){this.uniforms.parametricRimColorFactor.value=r}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(r){this.uniforms.rimMultiplyTexture.value=r}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(r){this.uniforms.rimLightingMixFactor.value=r}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(r){this.uniforms.parametricRimFresnelPowerFactor.value=r}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(r){this.uniforms.parametricRimLiftFactor.value=r}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(r){this.uniforms.outlineWidthMultiplyTexture.value=r}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(r){this.uniforms.outlineWidthFactor.value=r}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(r){this.uniforms.outlineColorFactor.value=r}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(r){this.uniforms.outlineLightingMixFactor.value=r}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(r){this.uniforms.uvAnimationMaskTexture.value=r}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(r){this.uniforms.uvAnimationScrollXOffset.value=r}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(r){this.uniforms.uvAnimationScrollYOffset.value=r}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(r){this.uniforms.uvAnimationRotationPhase.value=r}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(r){this._ignoreVertexColor=r,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(r){this._v0CompatShade=r,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(r){this._debugMode=r,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(r){this._outlineWidthMode=r,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(r){this._isOutline=r,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(r){this._uploadUniformsWorkaround(),this._updateUVAnimation(r)}copy(r){return super.copy(r),this.map=r.map,this.normalMap=r.normalMap,this.emissiveMap=r.emissiveMap,this.shadeMultiplyTexture=r.shadeMultiplyTexture,this.shadingShiftTexture=r.shadingShiftTexture,this.matcapTexture=r.matcapTexture,this.rimMultiplyTexture=r.rimMultiplyTexture,this.outlineWidthMultiplyTexture=r.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=r.uvAnimationMaskTexture,this.normalMapType=r.normalMapType,this.uvAnimationScrollXSpeedFactor=r.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=r.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=r.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=r.ignoreVertexColor,this.v0CompatShade=r.v0CompatShade,this.debugMode=r.debugMode,this.outlineWidthMode=r.outlineWidthMode,this.isOutline=r.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(r){this.uniforms.uvAnimationScrollXOffset.value+=r*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=r*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=r*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const r=parseInt(REVISION,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:r,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===MToonMaterialOutlineWidthMode.ScreenCoordinates}}_updateTextureMatrix(r,e){r.value&&(r.value.matrixAutoUpdate&&r.value.updateMatrix(),e.value.copy(r.value.matrix))}},POSSIBLE_SPEC_VERSIONS6=new Set(["1.0","1.0-beta"]),_MToonMaterialLoaderPlugin=class Kn{get name(){return Kn.EXTENSION_NAME}constructor(e,t={}){var n,i,a,l;this.parser=e,this.materialType=(n=t.materialType)!=null?n:MToonMaterial,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(a=t.v0CompatShade)!=null?a:!1,this.debugMode=(l=t.debugMode)!=null?l:"none",this._mToonMaterialSet=new Set}beforeRoot(){return __async3(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return __async3(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const n=this._getMToonExtension(e);return n?this._extendMaterialParams(n,t):null}loadMesh(e){return __async3(this,null,function*(){var t;const n=this.parser,a=(t=n.json.meshes)==null?void 0:t[e];if(a==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const l=a.primitives,u=yield n.loadMesh(e);if(l.length===1){const d=u,f=l[0].material;f!=null&&this._setupPrimitive(d,f)}else{const d=u;for(let f=0;f{var l;this._getMToonExtension(a)&&((l=i.extensions)!=null&&l.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,n;const l=(t=this.parser.json.materials)==null?void 0:t[e];if(l==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const u=(n=l.extensions)==null?void 0:n[Kn.EXTENSION_NAME];if(u==null)return;const d=u.specVersion;if(!POSSIBLE_SPEC_VERSIONS6.has(d)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Kn.EXTENSION_NAME} specVersion "${d}"`);return}return u}_extendMaterialParams(e,t){return __async3(this,null,function*(){var n;delete t.metalness,delete t.roughness;const i=new GLTFMToonMaterialParamsAssignHelper(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(n=e.shadingShiftTexture)==null?void 0:n.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const n=this._getMToonExtension(t);if(n){const i=this._parseRenderOrder(n);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof Material)||!this._shouldGenerateOutline(t))return;e.material=[t];const n=t.clone();n.name+=" (Outline)",n.isOutline=!0,n.side=BackSide,e.material.push(n);const i=e.geometry,a=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,a,0),i.addGroup(0,a,1)}_addToMaterialSet(e){const t=e.material,n=new Set;Array.isArray(t)?t.forEach(i=>n.add(i)):n.add(t);for(const i of n)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};_MToonMaterialLoaderPlugin.EXTENSION_NAME="VRMC_materials_mtoon";var MToonMaterialLoaderPlugin=_MToonMaterialLoaderPlugin,__async4=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),_VRMMaterialsHDREmissiveMultiplierLoaderPlugin=class ar{get name(){return ar.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return __async4(this,null,function*(){const n=this._getHDREmissiveMultiplierExtension(e);if(n==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=n.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,n;const l=(t=this.parser.json.materials)==null?void 0:t[e];if(l==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const u=(n=l.extensions)==null?void 0:n[ar.EXTENSION_NAME];if(u!=null)return u}};_VRMMaterialsHDREmissiveMultiplierLoaderPlugin.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var VRMMaterialsHDREmissiveMultiplierLoaderPlugin=_VRMMaterialsHDREmissiveMultiplierLoaderPlugin,__defProp2=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols2=Object.getOwnPropertySymbols,__hasOwnProp2=Object.prototype.hasOwnProperty,__propIsEnum2=Object.prototype.propertyIsEnumerable,__defNormalProp2=(r,e,t)=>e in r?__defProp2(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,__spreadValues2=(r,e)=>{for(var t in e||(e={}))__hasOwnProp2.call(e,t)&&__defNormalProp2(r,t,e[t]);if(__getOwnPropSymbols2)for(var t of __getOwnPropSymbols2(e))__propIsEnum2.call(e,t)&&__defNormalProp2(r,t,e[t]);return r},__spreadProps=(r,e)=>__defProps(r,__getOwnPropDescs(e)),__async5=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())});function gammaEOTF(r){return Math.pow(r,2.2)}var VRMMaterialsV0CompatPlugin=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(r){var e;this.parser=r,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return __async5(this,null,function*(){var r;const e=this.parser.json,t=(r=e.extensions)==null?void 0:r.VRM,n=t==null?void 0:t.materialProperties;n&&(this._populateRenderQueueMap(n),n.forEach((i,a)=>{var l,u;const d=(l=e.materials)==null?void 0:l[a];if(d==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${a}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const f=this._parseV0MToonProperties(i,d);e.materials[a]=f}else if((u=i.shader)!=null&&u.startsWith("VRM/Unlit")){const f=this._parseV0UnlitProperties(i,d);e.materials[a]=f}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(r,e){var t,n,i,a,l,u,d,f,m,s,o,c,v,y,_,b,x,w,S,T,E,M,P,A,C,D,k,j,I,W,L,U,H,Y,B,X,Z,z,_e,fe,We,ft,Te,G,K,ue,ke,Ie,F,ge,le,te,oe,pe,Be;const ze=(n=(t=r.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?n:!1,pt=((i=r.floatProperties)==null?void 0:i._ZWrite)===1&&ze,Et=this._v0ParseRenderQueue(r),Xe=(l=(a=r.keywordMap)==null?void 0:a._ALPHATEST_ON)!=null?l:!1,Ce=ze?"BLEND":Xe?"MASK":"OPAQUE",bt=Xe?(d=(u=r.floatProperties)==null?void 0:u._Cutoff)!=null?d:.5:void 0,Pt=((m=(f=r.floatProperties)==null?void 0:f._CullMode)!=null?m:2)===0,Nt=this._portTextureTransform(r),Yt=((o=(s=r.vectorProperties)==null?void 0:s._Color)!=null?o:[1,1,1,1]).map((jt,Jt)=>Jt===3?jt:gammaEOTF(jt)),Vt=(c=r.textureProperties)==null?void 0:c._MainTex,$t=Vt!=null?{index:Vt,extensions:__spreadValues2({},Nt)}:void 0,Rt=(y=(v=r.floatProperties)==null?void 0:v._BumpScale)!=null?y:1,ee=(_=r.textureProperties)==null?void 0:_._BumpMap,ce=ee!=null?{index:ee,scale:Rt,extensions:__spreadValues2({},Nt)}:void 0,wt=((x=(b=r.vectorProperties)==null?void 0:b._EmissionColor)!=null?x:[0,0,0,1]).map(gammaEOTF),Ct=(w=r.textureProperties)==null?void 0:w._EmissionMap,It=Ct!=null?{index:Ct,extensions:__spreadValues2({},Nt)}:void 0,Dt=((T=(S=r.vectorProperties)==null?void 0:S._ShadeColor)!=null?T:[.97,.81,.86,1]).map(gammaEOTF),rn=(E=r.textureProperties)==null?void 0:E._ShadeTexture,tn=rn!=null?{index:rn,extensions:__spreadValues2({},Nt)}:void 0;let Ot=(P=(M=r.floatProperties)==null?void 0:M._ShadeShift)!=null?P:0,kt=(C=(A=r.floatProperties)==null?void 0:A._ShadeToony)!=null?C:.9;kt=MathUtils.lerp(kt,1,.5+.5*Ot),Ot=-Ot-(1-kt);const Bt=(k=(D=r.floatProperties)==null?void 0:D._IndirectLightIntensity)!=null?k:.1,ln=Bt?1-Bt:void 0,en=(j=r.textureProperties)==null?void 0:j._SphereAdd,dn=en!=null?[1,1,1]:void 0,In=en!=null?{index:en}:void 0,Rn=(W=(I=r.floatProperties)==null?void 0:I._RimLightingMix)!=null?W:0,hn=(L=r.textureProperties)==null?void 0:L._RimTexture,Sn=hn!=null?{index:hn,extensions:__spreadValues2({},Nt)}:void 0,mn=((H=(U=r.vectorProperties)==null?void 0:U._RimColor)!=null?H:[0,0,0,1]).map(gammaEOTF),Mn=(B=(Y=r.floatProperties)==null?void 0:Y._RimFresnelPower)!=null?B:1,On=(Z=(X=r.floatProperties)==null?void 0:X._RimLift)!=null?Z:0,kn=["none","worldCoordinates","screenCoordinates"][(_e=(z=r.floatProperties)==null?void 0:z._OutlineWidthMode)!=null?_e:0];let vn=(We=(fe=r.floatProperties)==null?void 0:fe._OutlineWidth)!=null?We:0;vn=.01*vn;const yn=(ft=r.textureProperties)==null?void 0:ft._OutlineWidthTexture,Ln=yn!=null?{index:yn,extensions:__spreadValues2({},Nt)}:void 0,ie=((G=(Te=r.vectorProperties)==null?void 0:Te._OutlineColor)!=null?G:[0,0,0]).map(gammaEOTF),Me=((ue=(K=r.floatProperties)==null?void 0:K._OutlineColorMode)!=null?ue:0)===1?(Ie=(ke=r.floatProperties)==null?void 0:ke._OutlineLightingMix)!=null?Ie:1:0,Ne=(F=r.textureProperties)==null?void 0:F._UvAnimMaskTexture,Ge=Ne!=null?{index:Ne,extensions:__spreadValues2({},Nt)}:void 0,qe=(le=(ge=r.floatProperties)==null?void 0:ge._UvAnimScrollX)!=null?le:0;let At=(oe=(te=r.floatProperties)==null?void 0:te._UvAnimScrollY)!=null?oe:0;At!=null&&(At=-At);const Ft=(Be=(pe=r.floatProperties)==null?void 0:pe._UvAnimRotation)!=null?Be:0,Lt={specVersion:"1.0",transparentWithZWrite:pt,renderQueueOffsetNumber:Et,shadeColorFactor:Dt,shadeMultiplyTexture:tn,shadingShiftFactor:Ot,shadingToonyFactor:kt,giEqualizationFactor:ln,matcapFactor:dn,matcapTexture:In,rimLightingMixFactor:Rn,rimMultiplyTexture:Sn,parametricRimColorFactor:mn,parametricRimFresnelPowerFactor:Mn,parametricRimLiftFactor:On,outlineWidthMode:kn,outlineWidthFactor:vn,outlineWidthMultiplyTexture:Ln,outlineColorFactor:ie,outlineLightingMixFactor:Me,uvAnimationMaskTexture:Ge,uvAnimationScrollXSpeedFactor:qe,uvAnimationScrollYSpeedFactor:At,uvAnimationRotationSpeedFactor:Ft};return __spreadProps(__spreadValues2({},e),{pbrMetallicRoughness:{baseColorFactor:Yt,baseColorTexture:$t},normalTexture:ce,emissiveTexture:It,emissiveFactor:wt,alphaMode:Ce,alphaCutoff:bt,doubleSided:Pt,extensions:{VRMC_materials_mtoon:Lt}})}_parseV0UnlitProperties(r,e){var t,n,i,a,l;const u=r.shader==="VRM/UnlitTransparentZWrite",d=r.shader==="VRM/UnlitTransparent"||u,f=this._v0ParseRenderQueue(r),m=r.shader==="VRM/UnlitCutout",s=d?"BLEND":m?"MASK":"OPAQUE",o=m?(n=(t=r.floatProperties)==null?void 0:t._Cutoff)!=null?n:.5:void 0,c=this._portTextureTransform(r),v=((a=(i=r.vectorProperties)==null?void 0:i._Color)!=null?a:[1,1,1,1]).map(gammaEOTF),y=(l=r.textureProperties)==null?void 0:l._MainTex,_=y!=null?{index:y,extensions:__spreadValues2({},c)}:void 0,b={specVersion:"1.0",transparentWithZWrite:u,renderQueueOffsetNumber:f,shadeColorFactor:v,shadeMultiplyTexture:_};return __spreadProps(__spreadValues2({},e),{pbrMetallicRoughness:{baseColorFactor:v,baseColorTexture:_},alphaMode:s,alphaCutoff:o,extensions:{VRMC_materials_mtoon:b}})}_portTextureTransform(r){var e,t,n,i,a;const l=(e=r.vectorProperties)==null?void 0:e._MainTex;if(l==null)return{};const u=[(t=l==null?void 0:l[0])!=null?t:0,(n=l==null?void 0:l[1])!=null?n:0],d=[(i=l==null?void 0:l[2])!=null?i:1,(a=l==null?void 0:l[3])!=null?a:1];return u[1]=1-d[1]-u[1],{KHR_texture_transform:{offset:u,scale:d}}}_v0ParseRenderQueue(r){var e,t;const n=r.shader==="VRM/UnlitTransparentZWrite",i=((e=r.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||n,a=((t=r.floatProperties)==null?void 0:t._ZWrite)===1||n;let l=0;if(i){const u=r.renderQueue;u!=null&&(a?l=this._renderQueueMapTransparentZWrite.get(u):l=this._renderQueueMapTransparent.get(u))}return l}_populateRenderQueueMap(r){const e=new Set,t=new Set;r.forEach(n=>{var i,a;const l=n.shader==="VRM/UnlitTransparentZWrite",u=((i=n.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||l,d=((a=n.floatProperties)==null?void 0:a._ZWrite)===1||l;if(u){const f=n.renderQueue;f!=null&&(d?t.add(f):e.add(f))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((n,i)=>{const a=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(n,a)}),Array.from(t).sort().forEach((n,i)=>{const a=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(n,a)})}},__async6=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),_v3A6=new Vector3,VRMNodeConstraintHelper=class extends Group{constructor(r){super(),this._attrPosition=new BufferAttribute(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(DynamicDrawUsage);const e=new BufferGeometry;e.setAttribute("position",this._attrPosition);const t=new LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Line(e,t),this.add(this._line),this.constraint=r}updateMatrixWorld(r){_v3A6.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,_v3A6.x,_v3A6.y,_v3A6.z),this.constraint.source&&_v3A6.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,_v3A6.x,_v3A6.y,_v3A6.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(r)}};function decomposePosition(r,e){return e.set(r.elements[12],r.elements[13],r.elements[14])}var _v3A22=new Vector3,_v3B4=new Vector3;function decomposeRotation(r,e){return r.decompose(_v3A22,e,_v3B4),e}function quatInvertCompat2(r){return r.invert?r.invert():r.inverse(),r}var VRMNodeConstraint=class{constructor(r,e){this.destination=r,this.source=e,this.weight=1}},_v3A32=new Vector3,_v3B22=new Vector3,_v3C2=new Vector3,_quatA7=new Quaternion,_quatB4=new Quaternion,_quatC2=new Quaternion,VRMAimConstraint=class extends VRMNodeConstraint{get aimAxis(){return this._aimAxis}set aimAxis(r){this._aimAxis=r,this._v3AimAxis.set(r==="PositiveX"?1:r==="NegativeX"?-1:0,r==="PositiveY"?1:r==="NegativeY"?-1:0,r==="PositiveZ"?1:r==="NegativeZ"?-1:0)}get dependencies(){const r=new Set([this.source]);return this.destination.parent&&r.add(this.destination.parent),r}constructor(r,e){super(r,e),this._aimAxis="PositiveX",this._v3AimAxis=new Vector3(1,0,0),this._dstRestQuat=new Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const r=_quatA7.identity(),e=_quatB4.identity();this.destination.parent&&(decomposeRotation(this.destination.parent.matrixWorld,r),quatInvertCompat2(e.copy(r)));const t=_v3A32.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(r),n=decomposePosition(this.source.matrixWorld,_v3B22).sub(decomposePosition(this.destination.matrixWorld,_v3C2)).normalize(),i=_quatC2.setFromUnitVectors(t,n).premultiply(e).multiply(r).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function traverseAncestorsFromRoot(r,e){const t=[r];let n=r.parent;for(;n!==null;)t.unshift(n),n=n.parent;t.forEach(i=>{e(i)})}var VRMNodeConstraintManager=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(r){this._constraints.add(r);let e=this._objectConstraintsMap.get(r.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(r.destination,e)),e.add(r)}deleteConstraint(r){this._constraints.delete(r),this._objectConstraintsMap.get(r.destination).delete(r)}setInitState(){const r=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,r,e,n=>n.setInitState())}update(){const r=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,r,e,n=>n.update())}_processConstraint(r,e,t,n){if(t.has(r))return;if(e.has(r))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(r);const i=r.dependencies;for(const a of i)traverseAncestorsFromRoot(a,l=>{const u=this._objectConstraintsMap.get(l);if(u)for(const d of u)this._processConstraint(d,e,t,n)});n(r),t.add(r)}},_quatA22=new Quaternion,_quatB22=new Quaternion,VRMRotationConstraint=class extends VRMNodeConstraint{get dependencies(){return new Set([this.source])}constructor(r,e){super(r,e),this._dstRestQuat=new Quaternion,this._invSrcRestQuat=new Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),quatInvertCompat2(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const r=_quatA22.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=_quatB22.copy(this._dstRestQuat).multiply(r);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},_v3A42=new Vector3,_quatA32=new Quaternion,_quatB32=new Quaternion,VRMRollConstraint=class extends VRMNodeConstraint{get rollAxis(){return this._rollAxis}set rollAxis(r){this._rollAxis=r,this._v3RollAxis.set(r==="X"?1:0,r==="Y"?1:0,r==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(r,e){super(r,e),this._rollAxis="X",this._v3RollAxis=new Vector3(1,0,0),this._dstRestQuat=new Quaternion,this._invDstRestQuat=new Quaternion,this._invSrcRestQuatMulDstRestQuat=new Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),quatInvertCompat2(this._invDstRestQuat.copy(this._dstRestQuat)),quatInvertCompat2(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const r=_quatA32.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=_v3A42.copy(this._v3RollAxis).applyQuaternion(r),n=_quatB32.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(r);this.destination.quaternion.copy(this._dstRestQuat).slerp(n,this.weight)}},POSSIBLE_SPEC_VERSIONS7=new Set(["1.0","1.0-beta"]),_VRMNodeConstraintLoaderPlugin=class Gn{get name(){return Gn.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return __async6(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return __async6(this,null,function*(){var t;const n=this.parser.json;if(!(((t=n.extensionsUsed)==null?void 0:t.indexOf(Gn.EXTENSION_NAME))!==-1))return null;const a=new VRMNodeConstraintManager,l=yield this.parser.getDependencies("node");return l.forEach((u,d)=>{var f;const m=n.nodes[d],s=(f=m==null?void 0:m.extensions)==null?void 0:f[Gn.EXTENSION_NAME];if(s==null)return;const o=s.specVersion;if(!POSSIBLE_SPEC_VERSIONS7.has(o)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Gn.EXTENSION_NAME} specVersion "${o}"`);return}const c=s.constraint;if(c.roll!=null){const v=this._importRollConstraint(u,l,c.roll);a.addConstraint(v)}else if(c.aim!=null){const v=this._importAimConstraint(u,l,c.aim);a.addConstraint(v)}else if(c.rotation!=null){const v=this._importRotationConstraint(u,l,c.rotation);a.addConstraint(v)}}),e.scene.updateMatrixWorld(),a.setInitState(),a})}_importRollConstraint(e,t,n){const{source:i,rollAxis:a,weight:l}=n,u=t[i],d=new VRMRollConstraint(e,u);if(a!=null&&(d.rollAxis=a),l!=null&&(d.weight=l),this.helperRoot){const f=new VRMNodeConstraintHelper(d);this.helperRoot.add(f)}return d}_importAimConstraint(e,t,n){const{source:i,aimAxis:a,weight:l}=n,u=t[i],d=new VRMAimConstraint(e,u);if(a!=null&&(d.aimAxis=a),l!=null&&(d.weight=l),this.helperRoot){const f=new VRMNodeConstraintHelper(d);this.helperRoot.add(f)}return d}_importRotationConstraint(e,t,n){const{source:i,weight:a}=n,l=t[i],u=new VRMRotationConstraint(e,l);if(a!=null&&(u.weight=a),this.helperRoot){const d=new VRMNodeConstraintHelper(u);this.helperRoot.add(d)}return u}};_VRMNodeConstraintLoaderPlugin.EXTENSION_NAME="VRMC_node_constraint";var VRMNodeConstraintLoaderPlugin=_VRMNodeConstraintLoaderPlugin,__async7=(r,e,t)=>new Promise((n,i)=>{var a=d=>{try{u(t.next(d))}catch(f){i(f)}},l=d=>{try{u(t.throw(d))}catch(f){i(f)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(a,l);u((t=t.apply(r,e)).next())}),VRMSpringBoneColliderShape=class{},_v3A7=new Vector3,_v3B5=new Vector3,VRMSpringBoneColliderShapeCapsule=class extends VRMSpringBoneColliderShape{get type(){return"capsule"}constructor(r){var e,t,n,i;super(),this.offset=(e=r==null?void 0:r.offset)!=null?e:new Vector3(0,0,0),this.tail=(t=r==null?void 0:r.tail)!=null?t:new Vector3(0,0,0),this.radius=(n=r==null?void 0:r.radius)!=null?n:0,this.inside=(i=r==null?void 0:r.inside)!=null?i:!1}calculateCollision(r,e,t,n){_v3A7.setFromMatrixPosition(r),_v3B5.subVectors(this.tail,this.offset).applyMatrix4(r),_v3B5.sub(_v3A7);const i=_v3B5.lengthSq();n.copy(e).sub(_v3A7);const a=_v3B5.dot(n);a<=0||(i<=a||_v3B5.multiplyScalar(a/i),n.sub(_v3B5));const l=n.length(),u=this.inside?this.radius-t-l:l-t-this.radius;return u<0&&(n.multiplyScalar(1/l),this.inside&&n.negate()),u}},_v3A23=new Vector3,_mat3A=new Matrix3,VRMSpringBoneColliderShapePlane=class extends VRMSpringBoneColliderShape{get type(){return"plane"}constructor(r){var e,t;super(),this.offset=(e=r==null?void 0:r.offset)!=null?e:new Vector3(0,0,0),this.normal=(t=r==null?void 0:r.normal)!=null?t:new Vector3(0,0,1)}calculateCollision(r,e,t,n){n.setFromMatrixPosition(r),n.negate().add(e),_mat3A.getNormalMatrix(r),_v3A23.copy(this.normal).applyNormalMatrix(_mat3A).normalize();const i=n.dot(_v3A23)-t;return n.copy(_v3A23),i}},_v3A33=new Vector3,VRMSpringBoneColliderShapeSphere=class extends VRMSpringBoneColliderShape{get type(){return"sphere"}constructor(r){var e,t,n;super(),this.offset=(e=r==null?void 0:r.offset)!=null?e:new Vector3(0,0,0),this.radius=(t=r==null?void 0:r.radius)!=null?t:0,this.inside=(n=r==null?void 0:r.inside)!=null?n:!1}calculateCollision(r,e,t,n){n.subVectors(e,_v3A33.setFromMatrixPosition(r));const i=n.length(),a=this.inside?this.radius-t-i:i-t-this.radius;return a<0&&(n.multiplyScalar(1/i),this.inside&&n.negate()),a}},_v3A43=new Vector3,ColliderShapeCapsuleBufferGeometry=class extends BufferGeometry{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Vector3,this._currentTail=new Vector3,this._shape=r,this._attrPos=new BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,r=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),r=!0);const t=_v3A43.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),r=!0),r&&this._buildPosition()}_buildPosition(){_v3A43.copy(this._currentTail).sub(this._currentOffset);const r=_v3A43.length()/this._currentRadius;for(let n=0;n<=16;n++){const i=n/16*Math.PI;this._attrPos.setXYZ(n,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+n,r+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+n,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+n,r+Math.sin(i),0,Math.cos(i))}for(let n=0;n<32;n++){const i=n/16*Math.PI;this._attrPos.setXYZ(68+n,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+n,r,Math.sin(i),Math.cos(i))}const e=Math.atan2(_v3A43.y,Math.sqrt(_v3A43.x*_v3A43.x+_v3A43.z*_v3A43.z)),t=-Math.atan2(_v3A43.z,_v3A43.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let r=0;r<34;r++){const e=(r+1)%34;this._attrIndex.setXY(r*2,r,e),this._attrIndex.setXY(68+r*2,34+r,34+e)}for(let r=0;r<32;r++){const e=(r+1)%32;this._attrIndex.setXY(136+r*2,68+r,68+e),this._attrIndex.setXY(200+r*2,100+r,100+e)}this._attrIndex.needsUpdate=!0}},ColliderShapePlaneBufferGeometry=class extends BufferGeometry{constructor(r){super(),this.worldScale=1,this._currentOffset=new Vector3,this._currentNormal=new Vector3,this._shape=r,this._attrPos=new BufferAttribute(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new BufferAttribute(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),r=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),r=!0),r&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},ColliderShapeSphereBufferGeometry=class extends BufferGeometry{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Vector3,this._shape=r,this._attrPos=new BufferAttribute(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new BufferAttribute(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,r=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),r=!0),r&&this._buildPosition()}_buildPosition(){for(let r=0;r<32;r++){const e=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+r,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+r,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let r=0;r<32;r++){const e=(r+1)%32;this._attrIndex.setXY(r*2,r,e),this._attrIndex.setXY(64+r*2,32+r,32+e),this._attrIndex.setXY(128+r*2,64+r,64+e)}this._attrIndex.needsUpdate=!0}},_v3A52=new Vector3,VRMSpringBoneColliderHelper=class extends Group{constructor(r){if(super(),this.matrixAutoUpdate=!1,this.collider=r,this.collider.shape instanceof VRMSpringBoneColliderShapeSphere)this._geometry=new ColliderShapeSphereBufferGeometry(this.collider.shape);else if(this.collider.shape instanceof VRMSpringBoneColliderShapeCapsule)this._geometry=new ColliderShapeCapsuleBufferGeometry(this.collider.shape);else if(this.collider.shape instanceof VRMSpringBoneColliderShapePlane)this._geometry=new ColliderShapePlaneBufferGeometry(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(r){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=_v3A52.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(r)}},SpringBoneBufferGeometry=class extends BufferGeometry{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Vector3,this._springBone=r,this._attrPos=new BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,r=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),r=!0),r&&this._buildPosition()}_buildPosition(){for(let r=0;r<32;r++){const e=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+r,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+r,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let r=0;r<32;r++){const e=(r+1)%32;this._attrIndex.setXY(r*2,r,e),this._attrIndex.setXY(64+r*2,32+r,32+e),this._attrIndex.setXY(128+r*2,64+r,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},_v3A62=new Vector3,VRMSpringBoneJointHelper=class extends Group{constructor(r){super(),this.matrixAutoUpdate=!1,this.springBone=r,this._geometry=new SpringBoneBufferGeometry(this.springBone);const e=new LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(r){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=_v3A62.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(r)}},VRMSpringBoneCollider=class extends Object3D{constructor(r){super(),this.colliderMatrix=new Matrix4,this.shape=r}updateWorldMatrix(r,e){super.updateWorldMatrix(r,e),updateColliderMatrix(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function updateColliderMatrix(r,e,t){const n=e.elements;r.copy(e),t&&(r.elements[12]=n[0]*t.x+n[4]*t.y+n[8]*t.z+n[12],r.elements[13]=n[1]*t.x+n[5]*t.y+n[9]*t.z+n[13],r.elements[14]=n[2]*t.x+n[6]*t.y+n[10]*t.z+n[14])}var _matA=new Matrix4;function mat4InvertCompat(r){return r.invert?r.invert():r.getInverse(_matA.copy(r)),r}var Matrix4InverseCache=class{constructor(r){this._inverseCache=new Matrix4,this._shouldUpdateInverse=!0,this.matrix=r;const e={set:(t,n,i)=>(this._shouldUpdateInverse=!0,t[n]=i,!0)};this._originalElements=r.elements,r.elements=new Proxy(r.elements,e)}get inverse(){return this._shouldUpdateInverse&&(mat4InvertCompat(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},IDENTITY_MATRIX4=new Matrix4,_v3A72=new Vector3,_v3B23=new Vector3,_worldSpacePosition=new Vector3,_nextTail=new Vector3,_matA2=new Matrix4,VRMSpringBoneJoint=class{constructor(r,e,t={},n=[]){this._currentTail=new Vector3,this._prevTail=new Vector3,this._boneAxis=new Vector3,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Matrix4,this._initialLocalRotation=new Quaternion,this._initialLocalChildPosition=new Vector3;var i,a,l,u,d,f;this.bone=r,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(a=t.stiffness)!=null?a:1,gravityPower:(l=t.gravityPower)!=null?l:0,gravityDir:(d=(u=t.gravityDir)==null?void 0:u.clone())!=null?d:new Vector3(0,-1,0),dragForce:(f=t.dragForce)!=null?f:.4},this.colliderGroups=n}get dependencies(){const r=new Set,e=this.bone.parent;e&&r.add(e);for(let t=0;t{e(i)})}function traverseChildrenUntilConditionMet(r,e){r.children.forEach(t=>{e(t)||traverseChildrenUntilConditionMet(t,e)})}function lowestCommonAncestor(r){var e;const t=new Map;for(const n of r){let i=n;do{const a=((e=t.get(i))!=null?e:0)+1;if(a===r.size)return i;t.set(i,a),i=i.parent}while(i!==null)}return null}var VRMSpringBoneManager=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const r=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{r.add(t)})}),Array.from(r)}get colliders(){const r=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{r.add(t)})}),Array.from(r)}addJoint(r){this._joints.add(r);let e=this._objectSpringBonesMap.get(r.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(r.bone,e)),e.add(r),this._isSortedJointsDirty=!0}addSpringBone(r){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(r)}deleteJoint(r){this._joints.delete(r),this._objectSpringBonesMap.get(r.bone).delete(r),this._isSortedJointsDirty=!0}deleteSpringBone(r){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(r)}setInitState(){this._sortJoints();for(let r=0;r{var l,u;return((u=(l=this._objectSpringBonesMap.get(a))==null?void 0:l.size)!=null?u:0)>0?!0:(this._ancestors.push(a),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(r,e,t,n,i){if(t.has(r))return;if(e.has(r)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(r);const a=r.dependencies;for(const l of a){let u=!1,d=null;traverseAncestorsFromRoot2(l,f=>{const m=this._objectSpringBonesMap.get(f);if(m)for(const s of m)u=!0,this._insertJointSort(s,e,t,n,i);else u||(d=f)}),d&&i.add(d)}n.push(r),t.add(r)}_relevantChildrenUpdated(r){var e,t;return((t=(e=this._objectSpringBonesMap.get(r))==null?void 0:e.size)!=null?t:0)>0?!0:(r.updateWorldMatrix(!1,!1),!1)}},EXTENSION_NAME_EXTENDED_COLLIDER="VRMC_springBone_extended_collider",POSSIBLE_SPEC_VERSIONS8=new Set(["1.0","1.0-beta"]),POSSIBLE_SPEC_VERSIONS_EXTENDED_COLLIDERS=new Set(["1.0"]),_VRMSpringBoneLoaderPlugin=class Vn{get name(){return Vn.EXTENSION_NAME}constructor(e,t){var n;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(n=t==null?void 0:t.useExtendedColliders)!=null?n:!0}afterRoot(e){return __async7(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return __async7(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const n=yield this._v0Import(e);return n??null})}_v1Import(e){return __async7(this,null,function*(){var t,n,i,a,l;const u=e.parser.json;if(!(((t=u.extensionsUsed)==null?void 0:t.indexOf(Vn.EXTENSION_NAME))!==-1))return null;const f=new VRMSpringBoneManager,m=yield e.parser.getDependencies("node"),s=(n=u.extensions)==null?void 0:n[Vn.EXTENSION_NAME];if(!s)return null;const o=s.specVersion;if(!POSSIBLE_SPEC_VERSIONS8.has(o))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Vn.EXTENSION_NAME} specVersion "${o}"`),null;const c=(i=s.colliders)==null?void 0:i.map((y,_)=>{var b,x,w,S,T,E,M,P,A,C,D,k,j,I,W;const L=m[y.node];if(L==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${_} attempted to use the node #${y.node} but not found`),null;const U=y.shape,H=(b=y.extensions)==null?void 0:b[EXTENSION_NAME_EXTENDED_COLLIDER];if(this.useExtendedColliders&&H!=null){const Y=H.specVersion;if(!POSSIBLE_SPEC_VERSIONS_EXTENDED_COLLIDERS.has(Y))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${EXTENSION_NAME_EXTENDED_COLLIDER} specVersion "${Y}". Fallbacking to the ${Vn.EXTENSION_NAME} definition`);else{const B=H.shape;if(B.sphere)return this._importSphereCollider(L,{offset:new Vector3().fromArray((x=B.sphere.offset)!=null?x:[0,0,0]),radius:(w=B.sphere.radius)!=null?w:0,inside:(S=B.sphere.inside)!=null?S:!1});if(B.capsule)return this._importCapsuleCollider(L,{offset:new Vector3().fromArray((T=B.capsule.offset)!=null?T:[0,0,0]),radius:(E=B.capsule.radius)!=null?E:0,tail:new Vector3().fromArray((M=B.capsule.tail)!=null?M:[0,0,0]),inside:(P=B.capsule.inside)!=null?P:!1});if(B.plane)return this._importPlaneCollider(L,{offset:new Vector3().fromArray((A=B.plane.offset)!=null?A:[0,0,0]),normal:new Vector3().fromArray((C=B.plane.normal)!=null?C:[0,0,1])})}}if(U.sphere)return this._importSphereCollider(L,{offset:new Vector3().fromArray((D=U.sphere.offset)!=null?D:[0,0,0]),radius:(k=U.sphere.radius)!=null?k:0,inside:!1});if(U.capsule)return this._importCapsuleCollider(L,{offset:new Vector3().fromArray((j=U.capsule.offset)!=null?j:[0,0,0]),radius:(I=U.capsule.radius)!=null?I:0,tail:new Vector3().fromArray((W=U.capsule.tail)!=null?W:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape`)}),v=(a=s.colliderGroups)==null?void 0:a.map((y,_)=>{var b;return{colliders:((b=y.colliders)!=null?b:[]).flatMap(w=>{const S=c==null?void 0:c[w];return S??(console.warn(`VRMSpringBoneLoaderPlugin: The colliderGroup #${_} attempted to use a collider #${w} but not found`),[])}),name:y.name}});return(l=s.springs)==null||l.forEach((y,_)=>{var b;const x=y.joints,w=(b=y.colliderGroups)==null?void 0:b.map(E=>{const M=v==null?void 0:v[E];if(M==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to use a colliderGroup ${E} but not found`);return M}),S=y.center!=null?m[y.center]:void 0;let T;x.forEach(E=>{if(T){const M=T.node,P=m[M],A=E.node,C=m[A],D={hitRadius:T.hitRadius,dragForce:T.dragForce,gravityPower:T.gravityPower,stiffness:T.stiffness,gravityDir:T.gravityDir!=null?new Vector3().fromArray(T.gravityDir):void 0},k=this._importJoint(P,C,D,w);S&&(k.center=S),f.addJoint(k)}T=E})}),f.setInitState(),f})}_v0Import(e){return __async7(this,null,function*(){var t,n,i;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const u=(n=a.extensions)==null?void 0:n.VRM,d=u==null?void 0:u.secondaryAnimation;if(!d)return null;const f=d==null?void 0:d.boneGroups;if(!f)return null;const m=new VRMSpringBoneManager,s=yield e.parser.getDependencies("node"),o=(i=d.colliderGroups)==null?void 0:i.map(c=>{var v;const y=s[c.node];return{colliders:((v=c.colliders)!=null?v:[]).map((b,x)=>{var w,S,T;const E=new Vector3(0,0,0);return b.offset&&E.set((w=b.offset.x)!=null?w:0,(S=b.offset.y)!=null?S:0,b.offset.z?-b.offset.z:0),this._importSphereCollider(y,{offset:E,radius:(T=b.radius)!=null?T:0,inside:!1})})}});return f==null||f.forEach((c,v)=>{const y=c.bones;y&&y.forEach(_=>{var b,x,w,S;const T=s[_],E=new Vector3;c.gravityDir?E.set((b=c.gravityDir.x)!=null?b:0,(x=c.gravityDir.y)!=null?x:0,(w=c.gravityDir.z)!=null?w:0):E.set(0,-1,0);const M=c.center!=null?s[c.center]:void 0,P={hitRadius:c.hitRadius,dragForce:c.dragForce,gravityPower:c.gravityPower,stiffness:c.stiffiness,gravityDir:E},A=(S=c.colliderGroups)==null?void 0:S.map(C=>{const D=o==null?void 0:o[C];if(D==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${v} attempted to use a colliderGroup ${C} but not found`);return D});T.traverse(C=>{var D;const k=(D=C.children[0])!=null?D:null,j=this._importJoint(C,k,P,A);M&&(j.center=M),m.addJoint(j)})})}),e.scene.updateMatrixWorld(),m.setInitState(),m})}_importJoint(e,t,n,i){const a=new VRMSpringBoneJoint(e,t,n,i);if(this.jointHelperRoot){const l=new VRMSpringBoneJointHelper(a);this.jointHelperRoot.add(l),l.renderOrder=this.jointHelperRoot.renderOrder}return a}_importSphereCollider(e,t){const n=new VRMSpringBoneColliderShapeSphere(t),i=new VRMSpringBoneCollider(n);if(e.add(i),this.colliderHelperRoot){const a=new VRMSpringBoneColliderHelper(i);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const n=new VRMSpringBoneColliderShapeCapsule(t),i=new VRMSpringBoneCollider(n);if(e.add(i),this.colliderHelperRoot){const a=new VRMSpringBoneColliderHelper(i);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const n=new VRMSpringBoneColliderShapePlane(t),i=new VRMSpringBoneCollider(n);if(e.add(i),this.colliderHelperRoot){const a=new VRMSpringBoneColliderHelper(i);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return i}};_VRMSpringBoneLoaderPlugin.EXTENSION_NAME="VRMC_springBone";var VRMSpringBoneLoaderPlugin=_VRMSpringBoneLoaderPlugin,VRMLoaderPlugin=class{get name(){return"VRMLoaderPlugin"}constructor(r,e){var t,n,i,a,l,u,d,f,m,s;this.parser=r;const o=e==null?void 0:e.helperRoot,c=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new VRMExpressionLoaderPlugin(r),this.firstPersonPlugin=(n=e==null?void 0:e.firstPersonPlugin)!=null?n:new VRMFirstPersonLoaderPlugin(r),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new VRMHumanoidLoaderPlugin(r,{helperRoot:o,autoUpdateHumanBones:c}),this.lookAtPlugin=(a=e==null?void 0:e.lookAtPlugin)!=null?a:new VRMLookAtLoaderPlugin(r,{helperRoot:o}),this.metaPlugin=(l=e==null?void 0:e.metaPlugin)!=null?l:new VRMMetaLoaderPlugin(r),this.mtoonMaterialPlugin=(u=e==null?void 0:e.mtoonMaterialPlugin)!=null?u:new MToonMaterialLoaderPlugin(r),this.materialsHDREmissiveMultiplierPlugin=(d=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?d:new VRMMaterialsHDREmissiveMultiplierLoaderPlugin(r),this.materialsV0CompatPlugin=(f=e==null?void 0:e.materialsV0CompatPlugin)!=null?f:new VRMMaterialsV0CompatPlugin(r),this.springBonePlugin=(m=e==null?void 0:e.springBonePlugin)!=null?m:new VRMSpringBoneLoaderPlugin(r,{colliderHelperRoot:o,jointHelperRoot:o}),this.nodeConstraintPlugin=(s=e==null?void 0:e.nodeConstraintPlugin)!=null?s:new VRMNodeConstraintLoaderPlugin(r,{helperRoot:o})}beforeRoot(){return __async(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(r){return __async(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(r)})}getMaterialType(r){const e=this.mtoonMaterialPlugin.getMaterialType(r);return e??null}extendMaterialParams(r,e){return __async(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(r,e),yield this.mtoonMaterialPlugin.extendMaterialParams(r,e)})}afterRoot(r){return __async(this,null,function*(){yield this.metaPlugin.afterRoot(r),yield this.humanoidPlugin.afterRoot(r),yield this.expressionPlugin.afterRoot(r),yield this.lookAtPlugin.afterRoot(r),yield this.firstPersonPlugin.afterRoot(r),yield this.springBonePlugin.afterRoot(r),yield this.nodeConstraintPlugin.afterRoot(r),yield this.mtoonMaterialPlugin.afterRoot(r);const e=r.userData.vrmMeta,t=r.userData.vrmHumanoid;if(e&&t){const n=new VRM({scene:r.scene,expressionManager:r.userData.vrmExpressionManager,firstPerson:r.userData.vrmFirstPerson,humanoid:t,lookAt:r.userData.vrmLookAt,meta:e,materials:r.userData.vrmMToonMaterials,springBoneManager:r.userData.vrmSpringBoneManager,nodeConstraintManager:r.userData.vrmNodeConstraintManager});r.userData.vrm=n}})}};function collectMeshes(r){const e=new Set;return r.traverse(t=>{if(!t.isMesh)return;const n=t;e.add(n)}),e}function combineMorph(r,e,t){if(e.size===1){const l=e.values().next().value;if(l.weight===1)return r[l.index]}const n=new Float32Array(r[0].count*3);let i=0;if(t)i=1;else for(const l of e)i+=l.weight;for(const l of e){const u=r[l.index],d=l.weight/i;for(let f=0;f{if(!t.isSkinnedMesh)return;const n=t;e.add(n)}),e}function listUsedIndices(r,e){const t=new Set;for(let n=0;nt)return!1;return!0}function disposeMaterial(r){if(Object.values(r).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),r.isShaderMaterial){const e=r.uniforms;e&&Object.values(e).forEach(t=>{const n=t.value;n!=null&&n.isTexture&&n.dispose()})}r.dispose()}function dispose(r){const e=r.geometry;e&&e.dispose();const t=r.skeleton;t&&t.dispose();const n=r.material;n&&(Array.isArray(n)?n.forEach(i=>disposeMaterial(i)):n&&disposeMaterial(n))}function deepDispose(r){r.traverse(dispose)}function removeUnnecessaryJoints(r,e){var t,n;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,a=[];r.traverse(d=>{d.type==="SkinnedMesh"&&a.push(d)});const l=new Map;let u=0;for(const d of a){const m=d.geometry.getAttribute("skinIndex");if(l.has(m))continue;const s=new Map,o=new Map;for(let c=0;c{var n,i,a,l;if(!t.isMesh)return;const u=t,d=u.geometry,f=d.index;if(f==null)return;const m=e.get(d);if(m!=null){u.geometry=m;return}const s=Object.values(d.attributes)[0].count,o=new Array(s);let c=0;const v=f.array;for(let S=0;S{x.addGroup(S.start,S.count,S.materialIndex)}),x.boundingBox=(i=(n=d.boundingBox)==null?void 0:n.clone())!=null?i:null,x.boundingSphere=(l=(a=d.boundingSphere)==null?void 0:a.clone())!=null?l:null,x.setDrawRange(d.drawRange.start,d.drawRange.count),x.userData=d.userData,e.set(d,x);{const S=f.array,T=new S.constructor(S.length);for(let E=0;E{const T=d.attributes[S];if(T.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const E=T.array,{itemSize:M,normalized:P}=T,A=new E.constructor(_.length*M);_.forEach((C,D)=>{for(let k=0;k{x.morphAttributes[S]=[];const T=d.morphAttributes[S];for(let E=0;E{for(let I=0;Ik===0),x.morphAttributes[S][E]=new BufferAttribute(D,A,C)}}),w&&(x.morphAttributes={}),u.geometry=x}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function rotateVRM0(r){var e;((e=r.meta)==null?void 0:e.metaVersion)==="0"&&(r.scene.rotation.y=Math.PI)}var VRMUtils=class{constructor(){}};VRMUtils.combineMorphs=combineMorphs;VRMUtils.combineSkeletons=combineSkeletons;VRMUtils.deepDispose=deepDispose;VRMUtils.removeUnnecessaryJoints=removeUnnecessaryJoints;VRMUtils.removeUnnecessaryVertices=removeUnnecessaryVertices;VRMUtils.rotateVRM0=rotateVRM0;/*! - * @pixiv/three-vrm-core v3.3.2 - * The implementation of core features of VRM, for @pixiv/three-vrm - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-core is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - *//*! - * @pixiv/three-vrm-materials-mtoon v3.3.2 - * MToon (toon material) module for @pixiv/three-vrm - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-materials-mtoon is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - *//*! - * @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.3.2 - * Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-materials-hdr-emissive-multiplier is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - *//*! - * @pixiv/three-vrm-materials-v0compat v3.3.2 - * VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-materials-v0compat is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - *//*! - * @pixiv/three-vrm-node-constraint v3.3.2 - * Node constraint module for @pixiv/three-vrm - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-node-constraint is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - *//*! - * @pixiv/three-vrm-springbone v3.3.2 - * Spring bone module for @pixiv/three-vrm - * - * Copyright (c) 2019-2024 pixiv Inc. - * @pixiv/three-vrm-springbone is distributed under MIT License - * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */function toTrianglesDrawMode(r,e){if(e===TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===TriangleFanDrawMode||e===TriangleStripDrawMode){let t=r.getIndex();if(t===null){const l=[],u=r.getAttribute("position");if(u!==void 0){for(let d=0;d=2.0 are supported."));return}const f=new GLTFParser(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});f.fileLoader.setRequestHeader(this.requestHeader);for(let m=0;m=0&&u[s]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+s+'".')}}f.setExtensions(l),f.setPlugins(u),f.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,a){n.parse(e,t,i,a)})}}function GLTFRegistry(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const EXTENSIONS={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 GLTFLightsExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,a=i.textures[e];if(!a.extensions||!a.extensions[t])return null;const l=a.extensions[t],u=i.images[l.source];let d=n.textureLoader;if(u.uri){const f=n.options.manager.getHandler(u.uri);f!==null&&(d=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,l.source,d);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=EXTENSIONS.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,a=i.textures[e];if(!a.extensions||!a.extensions[t])return null;const l=a.extensions[t],u=i.images[l.source];let d=n.textureLoader;if(u.uri){const f=n.options.manager.getHandler(u.uri);f!==null&&(d=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,l.source,d);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=EXTENSIONS.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],a=this.parser.getDependency("buffer",i.buffer),l=this.parser.options.meshoptDecoder;if(!l||!l.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return a.then(function(u){const d=i.byteOffset||0,f=i.byteLength||0,m=i.count,s=i.byteStride,o=new Uint8Array(u,d,f);return l.decodeGltfBufferAsync?l.decodeGltfBufferAsync(m,s,o,i.mode,i.filter).then(function(c){return c.buffer}):l.ready.then(function(){const c=new ArrayBuffer(m*s);return l.decodeGltfBuffer(new Uint8Array(c),m,s,o,i.mode,i.filter),c})})}else return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=EXTENSIONS.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const f of i.primitives)if(f.mode!==WEBGL_CONSTANTS.TRIANGLES&&f.mode!==WEBGL_CONSTANTS.TRIANGLE_STRIP&&f.mode!==WEBGL_CONSTANTS.TRIANGLE_FAN&&f.mode!==void 0)return null;const l=n.extensions[this.name].attributes,u=[],d={};for(const f in l)u.push(this.parser.getDependency("accessor",l[f]).then(m=>(d[f]=m,d[f])));return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(f=>{const m=f.pop(),s=m.isGroup?m.children:[m],o=f[0].count,c=[];for(const v of s){const y=new Matrix4,_=new Vector3,b=new Quaternion,x=new Vector3(1,1,1),w=new InstancedMesh(v.geometry,v.material,o);for(let S=0;S0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const _identityMatrix=new Matrix4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,a=!1,l=-1;if(typeof navigator<"u"){const u=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(u)===!0;const d=u.match(/Version\/(\d+)/);i=n&&d?parseInt(d[1],10):-1,a=u.indexOf("Firefox")>-1,l=a?u.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||a&&l<98?this.textureLoader=new TextureLoader(this.options.manager):this.textureLoader=new ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new FileLoader$1(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,a=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(l){return l._markDefs&&l._markDefs()}),Promise.all(this._invokeAll(function(l){return l.beforeRoot&&l.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(l){const u={scene:l[0][i.scene||0],scenes:l[0],animations:l[1],cameras:l[2],asset:i.asset,parser:n,userData:{}};return addUnknownExtensionsToUserData(a,u,i),assignExtrasToUserData(u,i),Promise.all(n._invokeAll(function(d){return d.afterRoot&&d.afterRoot(u)})).then(function(){for(const d of u.scenes)d.updateMatrixWorld();e(u)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,a=t.length;i{const d=this.associations.get(l);d!=null&&this.associations.set(u,d);for(const[f,m]of l.children.entries())a(m,u.children[f])};return a(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&_.setY(A,E[M*d+1]),d>=3&&_.setZ(A,E[M*d+2]),d>=4&&_.setW(A,E[M*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}_.normalized=v}return _})}loadTexture(e){const t=this.json,n=this.options,a=t.textures[e].source,l=t.images[a];let u=this.textureLoader;if(l.uri){const d=n.manager.getHandler(l.uri);d!==null&&(u=d)}return this.loadTextureImage(e,a,u)}loadTextureImage(e,t,n){const i=this,a=this.json,l=a.textures[e],u=a.images[t],d=(u.uri||u.bufferView)+":"+l.sampler;if(this.textureCache[d])return this.textureCache[d];const f=this.loadImageSource(t,n).then(function(m){m.flipY=!1,m.name=l.name||u.name||"",m.name===""&&typeof u.uri=="string"&&u.uri.startsWith("data:image/")===!1&&(m.name=u.uri);const o=(a.samplers||{})[l.sampler]||{};return m.magFilter=WEBGL_FILTERS[o.magFilter]||LinearFilter,m.minFilter=WEBGL_FILTERS[o.minFilter]||LinearMipmapLinearFilter,m.wrapS=WEBGL_WRAPPINGS[o.wrapS]||RepeatWrapping,m.wrapT=WEBGL_WRAPPINGS[o.wrapT]||RepeatWrapping,m.generateMipmaps=!m.isCompressedTexture&&m.minFilter!==NearestFilter&&m.minFilter!==LinearFilter,i.associations.set(m,{textures:e}),m}).catch(function(){return null});return this.textureCache[d]=f,f}loadImageSource(e,t){const n=this,i=this.json,a=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(s=>s.clone());const l=i.images[e],u=self.URL||self.webkitURL;let d=l.uri||"",f=!1;if(l.bufferView!==void 0)d=n.getDependency("bufferView",l.bufferView).then(function(s){f=!0;const o=new Blob([s],{type:l.mimeType});return d=u.createObjectURL(o),d});else if(l.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const m=Promise.resolve(d).then(function(s){return new Promise(function(o,c){let v=o;t.isImageBitmapLoader===!0&&(v=function(y){const _=new Texture$1(y);_.needsUpdate=!0,o(_)}),t.load(LoaderUtils.resolveURL(s,a.path),v,void 0,c)})}).then(function(s){return f===!0&&u.revokeObjectURL(d),assignExtrasToUserData(s,l),s.userData.mimeType=l.mimeType||getImageURIMimeType(l.uri),s}).catch(function(s){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),s});return this.sourceCache[e]=m,m}assignTexture(e,t,n,i){const a=this;return this.getDependency("texture",n.index).then(function(l){if(!l)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(l=l.clone(),l.channel=n.texCoord),a.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]){const u=n.extensions!==void 0?n.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]:void 0;if(u){const d=a.associations.get(l);l=a.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(l,u),a.associations.set(l,d)}}return i!==void 0&&(l.colorSpace=i),e[t]=l,l})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,a=t.attributes.color!==void 0,l=t.attributes.normal===void 0;if(e.isPoints){const u="PointsMaterial:"+n.uuid;let d=this.cache.get(u);d||(d=new PointsMaterial,Material.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,d.sizeAttenuation=!1,this.cache.add(u,d)),n=d}else if(e.isLine){const u="LineBasicMaterial:"+n.uuid;let d=this.cache.get(u);d||(d=new LineBasicMaterial,Material.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,this.cache.add(u,d)),n=d}if(i||a||l){let u="ClonedMaterial:"+n.uuid+":";i&&(u+="derivative-tangents:"),a&&(u+="vertex-colors:"),l&&(u+="flat-shading:");let d=this.cache.get(u);d||(d=n.clone(),a&&(d.vertexColors=!0),l&&(d.flatShading=!0),i&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(u,d),this.associations.set(d,this.associations.get(n))),n=d}e.material=n}getMaterialType(){return MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,i=this.extensions,a=n.materials[e];let l;const u={},d=a.extensions||{},f=[];if(d[EXTENSIONS.KHR_MATERIALS_UNLIT]){const s=i[EXTENSIONS.KHR_MATERIALS_UNLIT];l=s.getMaterialType(),f.push(s.extendParams(u,a,t))}else{const s=a.pbrMetallicRoughness||{};if(u.color=new Color(1,1,1),u.opacity=1,Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;u.color.setRGB(o[0],o[1],o[2],LinearSRGBColorSpace),u.opacity=o[3]}s.baseColorTexture!==void 0&&f.push(t.assignTexture(u,"map",s.baseColorTexture,SRGBColorSpace)),u.metalness=s.metallicFactor!==void 0?s.metallicFactor:1,u.roughness=s.roughnessFactor!==void 0?s.roughnessFactor:1,s.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(u,"metalnessMap",s.metallicRoughnessTexture)),f.push(t.assignTexture(u,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne(function(o){return o.getMaterialType&&o.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(o){return o.extendMaterialParams&&o.extendMaterialParams(e,u)})))}a.doubleSided===!0&&(u.side=DoubleSide);const m=a.alphaMode||ALPHA_MODES.OPAQUE;if(m===ALPHA_MODES.BLEND?(u.transparent=!0,u.depthWrite=!1):(u.transparent=!1,m===ALPHA_MODES.MASK&&(u.alphaTest=a.alphaCutoff!==void 0?a.alphaCutoff:.5)),a.normalTexture!==void 0&&l!==MeshBasicMaterial&&(f.push(t.assignTexture(u,"normalMap",a.normalTexture)),u.normalScale=new Vector2(1,1),a.normalTexture.scale!==void 0)){const s=a.normalTexture.scale;u.normalScale.set(s,s)}if(a.occlusionTexture!==void 0&&l!==MeshBasicMaterial&&(f.push(t.assignTexture(u,"aoMap",a.occlusionTexture)),a.occlusionTexture.strength!==void 0&&(u.aoMapIntensity=a.occlusionTexture.strength)),a.emissiveFactor!==void 0&&l!==MeshBasicMaterial){const s=a.emissiveFactor;u.emissive=new Color().setRGB(s[0],s[1],s[2],LinearSRGBColorSpace)}return a.emissiveTexture!==void 0&&l!==MeshBasicMaterial&&f.push(t.assignTexture(u,"emissiveMap",a.emissiveTexture,SRGBColorSpace)),Promise.all(f).then(function(){const s=new l(u);return a.name&&(s.name=a.name),assignExtrasToUserData(s,a),t.associations.set(s,{materials:e}),a.extensions&&addUnknownExtensionsToUserData(i,s,a),s})}createUniqueName(e){const t=PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function a(u){return n[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(u,t).then(function(d){return addPrimitiveAttributes(d,u,t)})}const l=[];for(let u=0,d=e.length;u0&&updateMorphTargets(b,a),b.name=t.createUniqueName(a.name||"mesh_"+e),assignExtrasToUserData(b,a),_.extensions&&addUnknownExtensionsToUserData(i,b,_),t.assignFinalMaterial(b),s.push(b)}for(let c=0,v=s.length;c1?m=new Group:f.length===1?m=f[0]:m=new Object3D,m!==f[0])for(let s=0,o=f.length;s{const s=new Map;for(const[o,c]of i.associations)(o instanceof Material||o instanceof Texture$1)&&s.set(o,c);return m.traverse(o=>{const c=i.associations.get(o);c!=null&&s.set(o,c)}),s};return i.associations=f(a),a})}_createAnimationTracks(e,t,n,i,a){const l=[],u=e.name?e.name:e.uuid,d=[];PATH_PROPERTIES[a.path]===PATH_PROPERTIES.weights?e.traverse(function(o){o.morphTargetInfluences&&d.push(o.name?o.name:o.uuid)}):d.push(u);let f;switch(PATH_PROPERTIES[a.path]){case PATH_PROPERTIES.weights:f=NumberKeyframeTrack;break;case PATH_PROPERTIES.rotation:f=QuaternionKeyframeTrack;break;case PATH_PROPERTIES.position:case PATH_PROPERTIES.scale:f=VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:f=NumberKeyframeTrack;break;case 2:case 3:default:f=VectorKeyframeTrack;break}break}const m=i.interpolation!==void 0?INTERPOLATION[i.interpolation]:InterpolateLinear,s=this._getArrayFromAccessor(n);for(let o=0,c=d.length;onew VRMLoaderPlugin(r)),loader.register(r=>new VRMAnimationLoaderPlugin(r)),loader)}async function loadVRMAnimation(r){const n=(await useVRMLoader().loadAsync(r)).userData;if(!n.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(n.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return n.vrmAnimations[0]}async function clipFromVRMAnimation(r,e){if(!r){console.warn("No VRM found");return}if(e)return createVRMAnimationClip(e,r)}function useBlink(){const r=ref$1(!1),e=ref$1(0),t=ref$1(0),n=.2,i=1,a=6,l=ref$1(Math.random()*(a-i)+i);function u(d,f){if(d!=null&&d.expressionManager&&(t.value+=f,!r.value&&t.value>=l.value&&(r.value=!0,e.value=0),r.value)){e.value+=f/n;const m=Math.sin(Math.PI*e.value);d.expressionManager.setValue("blink",m),e.value>=1&&(r.value=!1,t.value=0,d.expressionManager.setValue("blink",0),l.value=Math.random()*(a-i)+i)}}return{update:u}}async function loadVrm(r,e){const i=(await useVRMLoader().loadAsync(r,l=>{var u;return(u=e==null?void 0:e.onProgress)==null?void 0:u.call(e,l)})).userData;if(!i.vrm)return;const a=i.vrm;if(VRMUtils.removeUnnecessaryVertices(a.scene),VRMUtils.combineSkeletons(a.scene),a.scene.traverse(l=>{l.frustumCulled=!1}),a.lookAt){const l=new VRMLookAtQuaternionProxy(a.lookAt);l.name="lookAtQuaternionProxy",a.scene.add(l)}return e!=null&&e.scene&&e.scene.add(a.scene),e!=null&&e.position&&a.scene.position.set(...e.position),a}function useVRMEmote(r){const e=ref$1(null),t=ref$1(!1),n=ref$1(0),i=ref$1(new Map),a=ref$1(new Map),l=ref$1(),u=(b,x,w)=>b+(x-b)*w,d=b=>b<.5?4*b*b*b:1-(-2*b+2)**3/2,f=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}]]),m=()=>{l.value&&(clearTimeout(l.value),l.value=void 0)},s=b=>{var w;if(m(),!f.has(b)){console.warn(`Emotion ${b} not found`);return}const x=f.get(b);if(e.value=b,t.value=!0,n.value=0,r.expressionManager){const S=Object.keys(r.expressionManager.expressionMap);for(const T of S)r.expressionManager.setValue(T,0)}i.value.clear(),a.value.clear();for(const S of x.expression||[]){const T=((w=r.expressionManager)==null?void 0:w.getValue(S.name))||0;i.value.set(S.name,T),a.value.set(S.name,S.value)}};return{currentEmotion:e,isTransitioning:t,setEmotion:s,setEmotionWithResetAfter:(b,x)=>{m(),s(b),l.value=setTimeout(()=>{s("neutral"),l.value=void 0},x)},update:b=>{var S;if(!t.value||!e.value)return;const w=f.get(e.value).blendDuration||.3;n.value+=b/w,n.value>=1&&(n.value=1,t.value=!1);for(const[T,E]of a.value){const M=i.value.get(T)||0,P=u(M,E,d(n.value));(S=r.expressionManager)==null||S.setValue(T,P)}},addEmotionState:(b,x)=>{f.set(b,x)},removeEmotionState:b=>{f.delete(b)},dispose:()=>{m()}}}const _sfc_main$3=defineComponent({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null},emits:["loadModelProgress","error"],setup(r,{expose:e,emit:t}){const n=r,i=t,a=ref$1(),l=ref$1(),{scene:u}=me(),{onBeforeRender:d}=Zr(),f=useBlink(),m=ref$1();return watch(()=>n.position,([s,o,c])=>{a.value&&a.value.scene.position.set(s,o,c)}),onMounted(async()=>{if(u.value)try{const s=await loadVrm(n.model,{scene:u.value,lookAt:!0,position:n.position,onProgress:v=>i("loadModelProgress",Number.parseFloat((100*(v.loaded/v.total)).toFixed(2)))});if(!s){console.warn("No VRM model loaded");return}const o=await loadVRMAnimation(n.idleAnimation),c=await clipFromVRMAnimation(s,o);if(!c){console.warn("No VRM animation loaded");return}l.value=new AnimationMixer(s.scene),l.value.clipAction(c).play(),m.value=useVRMEmote(s),d(({delta:v})=>{var y,_,b;(y=l.value)==null||y.update(v),(_=a.value)==null||_.update(v),f.update(a.value,v),(b=m.value)==null||b.update(v)}),a.value=s}catch(s){i("error",s)}}),onUnmounted(()=>{if(a.value){const{scene:s}=me();s.value.remove(a.value.scene)}}),e({setExpression(s){var o;(o=m.value)==null||o.setEmotionWithResetAfter(s,1e3)}}),(s,o)=>renderSlot(s.$slots,"default")}}),_hoisted_1$2=["position"],_hoisted_2$2={absolute:"",bottom:"2",right:"2"},_hoisted_3$1={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":""},_hoisted_4$1=["checked","aria-checked"],_hoisted_5$1={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var v;(v=o.value)==null||v.setExpression(c)}}),(c,v)=>{const y=_sfc_main$h;return openBlock(),createBlock(_sfc_main$7,{relative:""},{default:withCtx(({height:_,width:b})=>[createVNode(unref(Hr),{alpha:!0,antialias:!0,width:b,height:_},{default:withCtx(()=>[createVNode(unref(Ug)),createBaseVNode("TresPerspectiveCamera",{position:[l.value,u.value,d.value]},null,8,_hoisted_1$2),v[14]||(v[14]=createBaseVNode("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),v[15]||(v[15]=createBaseVNode("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),createVNode(_sfc_main$3,{ref_key:"modelRef",ref:o,model:n.model,"idle-animation":n.idleAnimation,position:[f.value,m.value,s.value],onLoadModelProgress:v[0]||(v[0]=x=>i("loadModelProgress",x)),onError:v[1]||(v[1]=x=>i("error",x))},null,8,["model","idle-animation","position"])]),_:2},1032,["width","height"]),createBaseVNode("div",_hoisted_2$2,[createBaseVNode("div",_hoisted_3$1,[createBaseVNode("label",{"h-fit":"","cursor-pointer":"",class:normalizeClass([a.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":"",z:"a.value=x),checked:a.value,"aria-checked":a.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,_hoisted_4$1),[[vModelCheckbox,a.value]]),v[16]||(v[16]=createBaseVNode("div",{"select-none":""},[createBaseVNode("div",{"i-solar:bug-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800"})],-1))],2)]),createVNode(y,null,{default:withCtx(()=>[a.value?(openBlock(),createElementBlock("div",_hoisted_5$1,[createBaseVNode("div",_hoisted_6,[v[25]||(v[25]=createBaseVNode("div",{"font-mono":""},[createBaseVNode("span",null,"Model")],-1)),createVNode(_sfc_main$5,{"h-fit":"","w-full":""},{label:withCtx(()=>v[17]||(v[17]=[createBaseVNode("span",{"font-mono":""},"Camera",-1)])),default:withCtx(()=>[createBaseVNode("div",_hoisted_7,[v[18]||(v[18]=createBaseVNode("div",{text:"zinc-400 dark:zinc-500"},[createBaseVNode("span",null,"X")],-1)),createBaseVNode("label",_hoisted_8,[createVNode(_sfc_main$4,{modelValue:l.value,"onUpdate:modelValue":v[3]||(v[3]=x=>l.value=x),min:-10,max:10,step:.01},null,8,["modelValue"])]),createBaseVNode("div",_hoisted_9,[createBaseVNode("span",null,toDisplayString(l.value),1)]),v[19]||(v[19]=createBaseVNode("div",{text:"zinc-400 dark:zinc-500"},[createBaseVNode("span",null,"Y")],-1)),createBaseVNode("label",_hoisted_10,[createVNode(_sfc_main$4,{modelValue:u.value,"onUpdate:modelValue":v[4]||(v[4]=x=>u.value=x),min:-10,max:10,step:.01},null,8,["modelValue"])]),createBaseVNode("div",_hoisted_11,[createBaseVNode("span",null,toDisplayString(u.value),1)]),v[20]||(v[20]=createBaseVNode("div",{text:"zinc-400 dark:zinc-500"},[createBaseVNode("span",null,"Z")],-1)),createBaseVNode("label",_hoisted_12,[createVNode(_sfc_main$4,{modelValue:d.value,"onUpdate:modelValue":v[5]||(v[5]=x=>d.value=x),min:-10,max:10,step:.01},null,8,["modelValue"])]),createBaseVNode("div",_hoisted_13,[createBaseVNode("span",null,toDisplayString(d.value),1)])])]),_:1}),createVNode(_sfc_main$5,{"h-fit":"","w-full":""},{label:withCtx(()=>v[21]||(v[21]=[createBaseVNode("span",{"font-mono":""},"Model",-1)])),default:withCtx(()=>[createBaseVNode("div",_hoisted_14,[v[22]||(v[22]=createBaseVNode("div",{text:"zinc-400 dark:zinc-500"},[createBaseVNode("span",null,"X")],-1)),createBaseVNode("label",_hoisted_15,[createVNode(_sfc_main$4,{modelValue:f.value,"onUpdate:modelValue":v[6]||(v[6]=x=>f.value=x),min:-10,max:10,step:.01},null,8,["modelValue"])]),createBaseVNode("div",_hoisted_16,[createBaseVNode("span",null,toDisplayString(f.value),1)]),v[23]||(v[23]=createBaseVNode("div",{text:"zinc-400 dark:zinc-500"},[createBaseVNode("span",null,"Y")],-1)),createBaseVNode("label",_hoisted_17,[createVNode(_sfc_main$4,{modelValue:m.value,"onUpdate:modelValue":v[7]||(v[7]=x=>m.value=x),min:-10,max:10,step:.01},null,8,["modelValue"])]),createBaseVNode("div",_hoisted_18,[createBaseVNode("span",null,toDisplayString(m.value),1)]),v[24]||(v[24]=createBaseVNode("div",{text:"zinc-400 dark:zinc-500"},[createBaseVNode("span",null,"Z")],-1)),createBaseVNode("label",_hoisted_19,[createVNode(_sfc_main$4,{modelValue:s.value,"onUpdate:modelValue":v[8]||(v[8]=x=>s.value=x),min:-10,max:10,step:.01},null,8,["modelValue"])]),createBaseVNode("div",_hoisted_20,[createBaseVNode("span",null,toDisplayString(s.value),1)])])]),_:1}),v[26]||(v[26]=createBaseVNode("div",{"font-mono":""},[createBaseVNode("span",null,"Emotions")],-1)),createBaseVNode("div",_hoisted_21,[createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[9]||(v[9]=x=>{var w;return(w=o.value)==null?void 0:w.setExpression("neutral")})}," 🙂 Neutral "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[10]||(v[10]=x=>{var w;return(w=o.value)==null?void 0:w.setExpression("surprised")})}," 🤯 Surprised "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[11]||(v[11]=x=>{var w;return(w=o.value)==null?void 0:w.setExpression("sad")})}," 😫 Sad "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[12]||(v[12]=x=>{var w;return(w=o.value)==null?void 0:w.setExpression("angry")})}," 😠 Angry "),createBaseVNode("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[13]||(v[13]=x=>{var w;return(w=o.value)==null?void 0:w.setExpression("happy")})}," 😄 Happy ")])])])):createCommentVNode("",!0)]),_:1})])]),_:1})}}});function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jszip_min={exports:{}};/*! - -JSZip v3.10.1 - A JavaScript class for generating and reading zip files - - -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. - -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/main/LICENSE -*/var hasRequiredJszip_min;function requireJszip_min(){return hasRequiredJszip_min||(hasRequiredJszip_min=1,function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,a){function l(f,m){if(!i[f]){if(!n[f]){var s=typeof commonjsRequire=="function"&&commonjsRequire;if(!m&&s)return s(f,!0);if(u)return u(f,!0);var o=new Error("Cannot find module '"+f+"'");throw o.code="MODULE_NOT_FOUND",o}var c=i[f]={exports:{}};n[f][0].call(c.exports,function(v){var y=n[f][1][v];return l(y||v)},c,c.exports,t,n,i,a)}return i[f].exports}for(var u=typeof commonjsRequire=="function"&&commonjsRequire,d=0;d>2,c=(3&f)<<4|m>>4,v=1>6:64,y=2>4,m=(15&o)<<4|(c=u.indexOf(d.charAt(y++)))>>2,s=(3&c)<<6|(v=u.indexOf(d.charAt(y++))),x[_++]=f,c!==64&&(x[_++]=m),v!==64&&(x[_++]=s);return x}},{"./support":30,"./utils":32}],2:[function(t,n,i){var a=t("./external"),l=t("./stream/DataWorker"),u=t("./stream/Crc32Probe"),d=t("./stream/DataLengthProbe");function f(m,s,o,c,v){this.compressedSize=m,this.uncompressedSize=s,this.crc32=o,this.compression=c,this.compressedContent=v}f.prototype={getContentWorker:function(){var m=new l(a.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new d("data_length")),s=this;return m.on("end",function(){if(this.streamInfo.data_length!==s.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),m},getCompressedWorker:function(){return new l(a.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},f.createWorkerFrom=function(m,s,o){return m.pipe(new u).pipe(new d("uncompressedSize")).pipe(s.compressWorker(o)).pipe(new d("compressedSize")).withStreamInfo("compression",s)},n.exports=f},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,i){var a=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new a("STORE compression")},uncompressWorker:function(){return new a("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,i){var a=t("./utils"),l=function(){for(var u,d=[],f=0;f<256;f++){u=f;for(var m=0;m<8;m++)u=1&u?3988292384^u>>>1:u>>>1;d[f]=u}return d}();n.exports=function(u,d){return u!==void 0&&u.length?a.getTypeOf(u)!=="string"?function(f,m,s,o){var c=l,v=o+s;f^=-1;for(var y=o;y>>8^c[255&(f^m[y])];return-1^f}(0|d,u,u.length,0):function(f,m,s,o){var c=l,v=o+s;f^=-1;for(var y=o;y>>8^c[255&(f^m.charCodeAt(y))];return-1^f}(0|d,u,u.length,0):0}},{"./utils":32}],5:[function(t,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,n,i){var a=null;a=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:a}},{lie:37}],7:[function(t,n,i){var a=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=t("pako"),u=t("./utils"),d=t("./stream/GenericWorker"),f=a?"uint8array":"array";function m(s,o){d.call(this,"FlateWorker/"+s),this._pako=null,this._pakoAction=s,this._pakoOptions=o,this.meta={}}i.magic="\b\0",u.inherits(m,d),m.prototype.processChunk=function(s){this.meta=s.meta,this._pako===null&&this._createPako(),this._pako.push(u.transformTo(f,s.data),!1)},m.prototype.flush=function(){d.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},m.prototype.cleanUp=function(){d.prototype.cleanUp.call(this),this._pako=null},m.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var s=this;this._pako.onData=function(o){s.push({data:o,meta:s.meta})}},i.compressWorker=function(s){return new m("Deflate",s)},i.uncompressWorker=function(){return new m("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,i){function a(c,v){var y,_="";for(y=0;y>>=8;return _}function l(c,v,y,_,b,x){var w,S,T=c.file,E=c.compression,M=x!==f.utf8encode,P=u.transformTo("string",x(T.name)),A=u.transformTo("string",f.utf8encode(T.name)),C=T.comment,D=u.transformTo("string",x(C)),k=u.transformTo("string",f.utf8encode(C)),j=A.length!==T.name.length,I=k.length!==C.length,W="",L="",U="",H=T.dir,Y=T.date,B={crc32:0,compressedSize:0,uncompressedSize:0};v&&!y||(B.crc32=c.crc32,B.compressedSize=c.compressedSize,B.uncompressedSize=c.uncompressedSize);var X=0;v&&(X|=8),M||!j&&!I||(X|=2048);var Z=0,z=0;H&&(Z|=16),b==="UNIX"?(z=798,Z|=function(fe,We){var ft=fe;return fe||(ft=We?16893:33204),(65535&ft)<<16}(T.unixPermissions,H)):(z=20,Z|=function(fe){return 63&(fe||0)}(T.dosPermissions)),w=Y.getUTCHours(),w<<=6,w|=Y.getUTCMinutes(),w<<=5,w|=Y.getUTCSeconds()/2,S=Y.getUTCFullYear()-1980,S<<=4,S|=Y.getUTCMonth()+1,S<<=5,S|=Y.getUTCDate(),j&&(L=a(1,1)+a(m(P),4)+A,W+="up"+a(L.length,2)+L),I&&(U=a(1,1)+a(m(D),4)+k,W+="uc"+a(U.length,2)+U);var _e="";return _e+=` -\0`,_e+=a(X,2),_e+=E.magic,_e+=a(w,2),_e+=a(S,2),_e+=a(B.crc32,4),_e+=a(B.compressedSize,4),_e+=a(B.uncompressedSize,4),_e+=a(P.length,2),_e+=a(W.length,2),{fileRecord:s.LOCAL_FILE_HEADER+_e+P+W,dirRecord:s.CENTRAL_FILE_HEADER+a(z,2)+_e+a(D.length,2)+"\0\0\0\0"+a(Z,4)+a(_,4)+P+W+D}}var u=t("../utils"),d=t("../stream/GenericWorker"),f=t("../utf8"),m=t("../crc32"),s=t("../signature");function o(c,v,y,_){d.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=y,this.encodeFileName=_,this.streamFiles=c,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}u.inherits(o,d),o.prototype.push=function(c){var v=c.meta.percent||0,y=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(c):(this.bytesWritten+=c.data.length,d.prototype.push.call(this,{data:c.data,meta:{currentFile:this.currentFile,percent:y?(v+100*(y-_-1))/y:100}}))},o.prototype.openedSource=function(c){this.currentSourceOffset=this.bytesWritten,this.currentFile=c.file.name;var v=this.streamFiles&&!c.file.dir;if(v){var y=l(c,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},o.prototype.closedSource=function(c){this.accumulate=!1;var v=this.streamFiles&&!c.file.dir,y=l(c,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),v)this.push({data:function(_){return s.DATA_DESCRIPTOR+a(_.crc32,4)+a(_.compressedSize,4)+a(_.uncompressedSize,4)}(c),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},o.prototype.flush=function(){for(var c=this.bytesWritten,v=0;v=this.index;d--)f=(f<<8)+this.byteAt(d);return this.index+=u,f},readString:function(u){return a.transformTo("string",this.readData(u))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var u=this.readInt(4);return new Date(Date.UTC(1980+(u>>25&127),(u>>21&15)-1,u>>16&31,u>>11&31,u>>5&63,(31&u)<<1))}},n.exports=l},{"../utils":32}],19:[function(t,n,i){var a=t("./Uint8ArrayReader");function l(u){a.call(this,u)}t("../utils").inherits(l,a),l.prototype.readData=function(u){this.checkOffset(u);var d=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,d},n.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,i){var a=t("./DataReader");function l(u){a.call(this,u)}t("../utils").inherits(l,a),l.prototype.byteAt=function(u){return this.data.charCodeAt(this.zero+u)},l.prototype.lastIndexOfSignature=function(u){return this.data.lastIndexOf(u)-this.zero},l.prototype.readAndCheckSignature=function(u){return u===this.readData(4)},l.prototype.readData=function(u){this.checkOffset(u);var d=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,d},n.exports=l},{"../utils":32,"./DataReader":18}],21:[function(t,n,i){var a=t("./ArrayReader");function l(u){a.call(this,u)}t("../utils").inherits(l,a),l.prototype.readData=function(u){if(this.checkOffset(u),u===0)return new Uint8Array(0);var d=this.data.subarray(this.zero+this.index,this.zero+this.index+u);return this.index+=u,d},n.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,i){var a=t("../utils"),l=t("../support"),u=t("./ArrayReader"),d=t("./StringReader"),f=t("./NodeBufferReader"),m=t("./Uint8ArrayReader");n.exports=function(s){var o=a.getTypeOf(s);return a.checkSupport(o),o!=="string"||l.uint8array?o==="nodebuffer"?new f(s):l.uint8array?new m(a.transformTo("uint8array",s)):new u(a.transformTo("array",s)):new d(s)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,i){var a=t("./GenericWorker"),l=t("../utils");function u(d){a.call(this,"ConvertWorker to "+d),this.destType=d}l.inherits(u,a),u.prototype.processChunk=function(d){this.push({data:l.transformTo(this.destType,d.data),meta:d.meta})},n.exports=u},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,i){var a=t("./GenericWorker"),l=t("../crc32");function u(){a.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(u,a),u.prototype.processChunk=function(d){this.streamInfo.crc32=l(d.data,this.streamInfo.crc32||0),this.push(d)},n.exports=u},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,i){var a=t("../utils"),l=t("./GenericWorker");function u(d){l.call(this,"DataLengthProbe for "+d),this.propName=d,this.withStreamInfo(d,0)}a.inherits(u,l),u.prototype.processChunk=function(d){if(d){var f=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=f+d.data.length}l.prototype.processChunk.call(this,d)},n.exports=u},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,i){var a=t("../utils"),l=t("./GenericWorker");function u(d){l.call(this,"DataWorker");var f=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,d.then(function(m){f.dataIsReady=!0,f.data=m,f.max=m&&m.length||0,f.type=a.getTypeOf(m),f.isPaused||f._tickAndRepeat()},function(m){f.error(m)})}a.inherits(u,l),u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},u.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0)},u.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},u.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var d=null,f=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":d=this.data.substring(this.index,f);break;case"uint8array":d=this.data.subarray(this.index,f);break;case"array":case"nodebuffer":d=this.data.slice(this.index,f)}return this.index=f,this.push({data:d,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=u},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,i){function a(l){this.name=l||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}a.prototype={push:function(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,u){return this._listeners[l].push(u),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,u){if(this._listeners[l])for(var d=0;d "+l:l}},n.exports=a},{}],29:[function(t,n,i){var a=t("../utils"),l=t("./ConvertWorker"),u=t("./GenericWorker"),d=t("../base64"),f=t("../support"),m=t("../external"),s=null;if(f.nodestream)try{s=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function o(v,y){return new m.Promise(function(_,b){var x=[],w=v._internalType,S=v._outputType,T=v._mimeType;v.on("data",function(E,M){x.push(E),y&&y(M)}).on("error",function(E){x=[],b(E)}).on("end",function(){try{var E=function(M,P,A){switch(M){case"blob":return a.newBlob(a.transformTo("arraybuffer",P),A);case"base64":return d.encode(P);default:return a.transformTo(M,P)}}(S,function(M,P){var A,C=0,D=null,k=0;for(A=0;A"u")i.blob=!1;else{var a=new ArrayBuffer(0);try{i.blob=new Blob([a],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(a),i.blob=l.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,i){for(var a=t("./utils"),l=t("./support"),u=t("./nodejsUtils"),d=t("./stream/GenericWorker"),f=new Array(256),m=0;m<256;m++)f[m]=252<=m?6:248<=m?5:240<=m?4:224<=m?3:192<=m?2:1;f[254]=f[254]=1;function s(){d.call(this,"utf-8 decode"),this.leftOver=null}function o(){d.call(this,"utf-8 encode")}i.utf8encode=function(c){return l.nodebuffer?u.newBufferFrom(c,"utf-8"):function(v){var y,_,b,x,w,S=v.length,T=0;for(x=0;x>>6:(_<65536?y[w++]=224|_>>>12:(y[w++]=240|_>>>18,y[w++]=128|_>>>12&63),y[w++]=128|_>>>6&63),y[w++]=128|63&_);return y}(c)},i.utf8decode=function(c){return l.nodebuffer?a.transformTo("nodebuffer",c).toString("utf-8"):function(v){var y,_,b,x,w=v.length,S=new Array(2*w);for(y=_=0;y>10&1023,S[_++]=56320|1023&b)}return S.length!==_&&(S.subarray?S=S.subarray(0,_):S.length=_),a.applyFromCharCode(S)}(c=a.transformTo(l.uint8array?"uint8array":"array",c))},a.inherits(s,d),s.prototype.processChunk=function(c){var v=a.transformTo(l.uint8array?"uint8array":"array",c.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var y=v;(v=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),v.set(y,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var _=function(x,w){var S;for((w=w||x.length)>x.length&&(w=x.length),S=w-1;0<=S&&(192&x[S])==128;)S--;return S<0||S===0?w:S+f[x[S]]>w?S:w}(v),b=v;_!==v.length&&(l.uint8array?(b=v.subarray(0,_),this.leftOver=v.subarray(_,v.length)):(b=v.slice(0,_),this.leftOver=v.slice(_,v.length))),this.push({data:i.utf8decode(b),meta:c.meta})},s.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=s,a.inherits(o,d),o.prototype.processChunk=function(c){this.push({data:i.utf8encode(c.data),meta:c.meta})},i.Utf8EncodeWorker=o},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){var a=t("./support"),l=t("./base64"),u=t("./nodejsUtils"),d=t("./external");function f(y){return y}function m(y,_){for(var b=0;b>8;this.dir=!!(16&this.externalFileAttributes),c==0&&(this.dosPermissions=63&this.externalFileAttributes),c==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var c=a(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=c.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=c.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=c.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=c.readInt(4))}},readExtraFields:function(c){var v,y,_,b=c.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});c.index+4>>6:(c<65536?o[_++]=224|c>>>12:(o[_++]=240|c>>>18,o[_++]=128|c>>>12&63),o[_++]=128|c>>>6&63),o[_++]=128|63&c);return o},i.buf2binstring=function(s){return m(s,s.length)},i.binstring2buf=function(s){for(var o=new a.Buf8(s.length),c=0,v=o.length;c>10&1023,x[v++]=56320|1023&y)}return m(x,v)},i.utf8border=function(s,o){var c;for((o=o||s.length)>s.length&&(o=s.length),c=o-1;0<=c&&(192&s[c])==128;)c--;return c<0||c===0?o:c+d[s[c]]>o?c:o}},{"./common":41}],43:[function(t,n,i){n.exports=function(a,l,u,d){for(var f=65535&a|0,m=a>>>16&65535|0,s=0;u!==0;){for(u-=s=2e3>>1:l>>>1;u[d]=l}return u}();n.exports=function(l,u,d,f){var m=a,s=f+d;l^=-1;for(var o=f;o>>8^m[255&(l^u[o])];return-1^l}},{}],46:[function(t,n,i){var a,l=t("../utils/common"),u=t("./trees"),d=t("./adler32"),f=t("./crc32"),m=t("./messages"),s=0,o=4,c=0,v=-2,y=-1,_=4,b=2,x=8,w=9,S=286,T=30,E=19,M=2*S+1,P=15,A=3,C=258,D=C+A+1,k=42,j=113,I=1,W=2,L=3,U=4;function H(F,ge){return F.msg=m[ge],ge}function Y(F){return(F<<1)-(4F.avail_out&&(le=F.avail_out),le!==0&&(l.arraySet(F.output,ge.pending_buf,ge.pending_out,le,F.next_out),F.next_out+=le,ge.pending_out+=le,F.total_out+=le,F.avail_out-=le,ge.pending-=le,ge.pending===0&&(ge.pending_out=0))}function Z(F,ge){u._tr_flush_block(F,0<=F.block_start?F.block_start:-1,F.strstart-F.block_start,ge),F.block_start=F.strstart,X(F.strm)}function z(F,ge){F.pending_buf[F.pending++]=ge}function _e(F,ge){F.pending_buf[F.pending++]=ge>>>8&255,F.pending_buf[F.pending++]=255&ge}function fe(F,ge){var le,te,oe=F.max_chain_length,pe=F.strstart,Be=F.prev_length,ze=F.nice_match,be=F.strstart>F.w_size-D?F.strstart-(F.w_size-D):0,pt=F.window,Et=F.w_mask,Xe=F.prev,Ce=F.strstart+C,bt=pt[pe+Be-1],xt=pt[pe+Be];F.prev_length>=F.good_match&&(oe>>=2),ze>F.lookahead&&(ze=F.lookahead);do if(pt[(le=ge)+Be]===xt&&pt[le+Be-1]===bt&&pt[le]===pt[pe]&&pt[++le]===pt[pe+1]){pe+=2,le++;do;while(pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pt[++pe]===pt[++le]&&pebe&&--oe!=0);return Be<=F.lookahead?Be:F.lookahead}function We(F){var ge,le,te,oe,pe,Be,ze,be,pt,Et,Xe=F.w_size;do{if(oe=F.window_size-F.lookahead-F.strstart,F.strstart>=Xe+(Xe-D)){for(l.arraySet(F.window,F.window,Xe,Xe,0),F.match_start-=Xe,F.strstart-=Xe,F.block_start-=Xe,ge=le=F.hash_size;te=F.head[--ge],F.head[ge]=Xe<=te?te-Xe:0,--le;);for(ge=le=Xe;te=F.prev[--ge],F.prev[ge]=Xe<=te?te-Xe:0,--le;);oe+=Xe}if(F.strm.avail_in===0)break;if(Be=F.strm,ze=F.window,be=F.strstart+F.lookahead,pt=oe,Et=void 0,Et=Be.avail_in,pt=A)for(pe=F.strstart-F.insert,F.ins_h=F.window[pe],F.ins_h=(F.ins_h<=A&&(F.ins_h=(F.ins_h<=A)if(te=u._tr_tally(F,F.strstart-F.match_start,F.match_length-A),F.lookahead-=F.match_length,F.match_length<=F.max_lazy_match&&F.lookahead>=A){for(F.match_length--;F.strstart++,F.ins_h=(F.ins_h<=A&&(F.ins_h=(F.ins_h<=A&&F.match_length<=F.prev_length){for(oe=F.strstart+F.lookahead-A,te=u._tr_tally(F,F.strstart-1-F.prev_match,F.prev_length-A),F.lookahead-=F.prev_length-1,F.prev_length-=2;++F.strstart<=oe&&(F.ins_h=(F.ins_h<F.pending_buf_size-5&&(le=F.pending_buf_size-5);;){if(F.lookahead<=1){if(We(F),F.lookahead===0&&ge===s)return I;if(F.lookahead===0)break}F.strstart+=F.lookahead,F.lookahead=0;var te=F.block_start+le;if((F.strstart===0||F.strstart>=te)&&(F.lookahead=F.strstart-te,F.strstart=te,Z(F,!1),F.strm.avail_out===0)||F.strstart-F.block_start>=F.w_size-D&&(Z(F,!1),F.strm.avail_out===0))return I}return F.insert=0,ge===o?(Z(F,!0),F.strm.avail_out===0?L:U):(F.strstart>F.block_start&&(Z(F,!1),F.strm.avail_out),I)}),new G(4,4,8,4,ft),new G(4,5,16,8,ft),new G(4,6,32,32,ft),new G(4,4,16,16,Te),new G(8,16,32,32,Te),new G(8,16,128,128,Te),new G(8,32,128,256,Te),new G(32,128,258,1024,Te),new G(32,258,258,4096,Te)],i.deflateInit=function(F,ge){return Ie(F,ge,x,15,8,0)},i.deflateInit2=Ie,i.deflateReset=ke,i.deflateResetKeep=ue,i.deflateSetHeader=function(F,ge){return F&&F.state?F.state.wrap!==2?v:(F.state.gzhead=ge,c):v},i.deflate=function(F,ge){var le,te,oe,pe;if(!F||!F.state||5>8&255),z(te,te.gzhead.time>>16&255),z(te,te.gzhead.time>>24&255),z(te,te.level===9?2:2<=te.strategy||te.level<2?4:0),z(te,255&te.gzhead.os),te.gzhead.extra&&te.gzhead.extra.length&&(z(te,255&te.gzhead.extra.length),z(te,te.gzhead.extra.length>>8&255)),te.gzhead.hcrc&&(F.adler=f(F.adler,te.pending_buf,te.pending,0)),te.gzindex=0,te.status=69):(z(te,0),z(te,0),z(te,0),z(te,0),z(te,0),z(te,te.level===9?2:2<=te.strategy||te.level<2?4:0),z(te,3),te.status=j);else{var Be=x+(te.w_bits-8<<4)<<8;Be|=(2<=te.strategy||te.level<2?0:te.level<6?1:te.level===6?2:3)<<6,te.strstart!==0&&(Be|=32),Be+=31-Be%31,te.status=j,_e(te,Be),te.strstart!==0&&(_e(te,F.adler>>>16),_e(te,65535&F.adler)),F.adler=1}if(te.status===69)if(te.gzhead.extra){for(oe=te.pending;te.gzindex<(65535&te.gzhead.extra.length)&&(te.pending!==te.pending_buf_size||(te.gzhead.hcrc&&te.pending>oe&&(F.adler=f(F.adler,te.pending_buf,te.pending-oe,oe)),X(F),oe=te.pending,te.pending!==te.pending_buf_size));)z(te,255&te.gzhead.extra[te.gzindex]),te.gzindex++;te.gzhead.hcrc&&te.pending>oe&&(F.adler=f(F.adler,te.pending_buf,te.pending-oe,oe)),te.gzindex===te.gzhead.extra.length&&(te.gzindex=0,te.status=73)}else te.status=73;if(te.status===73)if(te.gzhead.name){oe=te.pending;do{if(te.pending===te.pending_buf_size&&(te.gzhead.hcrc&&te.pending>oe&&(F.adler=f(F.adler,te.pending_buf,te.pending-oe,oe)),X(F),oe=te.pending,te.pending===te.pending_buf_size)){pe=1;break}pe=te.gzindexoe&&(F.adler=f(F.adler,te.pending_buf,te.pending-oe,oe)),pe===0&&(te.gzindex=0,te.status=91)}else te.status=91;if(te.status===91)if(te.gzhead.comment){oe=te.pending;do{if(te.pending===te.pending_buf_size&&(te.gzhead.hcrc&&te.pending>oe&&(F.adler=f(F.adler,te.pending_buf,te.pending-oe,oe)),X(F),oe=te.pending,te.pending===te.pending_buf_size)){pe=1;break}pe=te.gzindexoe&&(F.adler=f(F.adler,te.pending_buf,te.pending-oe,oe)),pe===0&&(te.status=103)}else te.status=103;if(te.status===103&&(te.gzhead.hcrc?(te.pending+2>te.pending_buf_size&&X(F),te.pending+2<=te.pending_buf_size&&(z(te,255&F.adler),z(te,F.adler>>8&255),F.adler=0,te.status=j)):te.status=j),te.pending!==0){if(X(F),F.avail_out===0)return te.last_flush=-1,c}else if(F.avail_in===0&&Y(ge)<=Y(le)&&ge!==o)return H(F,-5);if(te.status===666&&F.avail_in!==0)return H(F,-5);if(F.avail_in!==0||te.lookahead!==0||ge!==s&&te.status!==666){var ze=te.strategy===2?function(be,pt){for(var Et;;){if(be.lookahead===0&&(We(be),be.lookahead===0)){if(pt===s)return I;break}if(be.match_length=0,Et=u._tr_tally(be,0,be.window[be.strstart]),be.lookahead--,be.strstart++,Et&&(Z(be,!1),be.strm.avail_out===0))return I}return be.insert=0,pt===o?(Z(be,!0),be.strm.avail_out===0?L:U):be.last_lit&&(Z(be,!1),be.strm.avail_out===0)?I:W}(te,ge):te.strategy===3?function(be,pt){for(var Et,Xe,Ce,bt,xt=be.window;;){if(be.lookahead<=C){if(We(be),be.lookahead<=C&&pt===s)return I;if(be.lookahead===0)break}if(be.match_length=0,be.lookahead>=A&&0be.lookahead&&(be.match_length=be.lookahead)}if(be.match_length>=A?(Et=u._tr_tally(be,1,be.match_length-A),be.lookahead-=be.match_length,be.strstart+=be.match_length,be.match_length=0):(Et=u._tr_tally(be,0,be.window[be.strstart]),be.lookahead--,be.strstart++),Et&&(Z(be,!1),be.strm.avail_out===0))return I}return be.insert=0,pt===o?(Z(be,!0),be.strm.avail_out===0?L:U):be.last_lit&&(Z(be,!1),be.strm.avail_out===0)?I:W}(te,ge):a[te.level].func(te,ge);if(ze!==L&&ze!==U||(te.status=666),ze===I||ze===L)return F.avail_out===0&&(te.last_flush=-1),c;if(ze===W&&(ge===1?u._tr_align(te):ge!==5&&(u._tr_stored_block(te,0,0,!1),ge===3&&(B(te.head),te.lookahead===0&&(te.strstart=0,te.block_start=0,te.insert=0))),X(F),F.avail_out===0))return te.last_flush=-1,c}return ge!==o?c:te.wrap<=0?1:(te.wrap===2?(z(te,255&F.adler),z(te,F.adler>>8&255),z(te,F.adler>>16&255),z(te,F.adler>>24&255),z(te,255&F.total_in),z(te,F.total_in>>8&255),z(te,F.total_in>>16&255),z(te,F.total_in>>24&255)):(_e(te,F.adler>>>16),_e(te,65535&F.adler)),X(F),0=le.w_size&&(pe===0&&(B(le.head),le.strstart=0,le.block_start=0,le.insert=0),pt=new l.Buf8(le.w_size),l.arraySet(pt,ge,Et-le.w_size,le.w_size,0),ge=pt,Et=le.w_size),Be=F.avail_in,ze=F.next_in,be=F.input,F.avail_in=Et,F.next_in=0,F.input=ge,We(le);le.lookahead>=A;){for(te=le.strstart,oe=le.lookahead-(A-1);le.ins_h=(le.ins_h<>>=A=P>>>24,w-=A,(A=P>>>16&255)===0)W[m++]=65535&P;else{if(!(16&A)){if(!(64&A)){P=S[(65535&P)+(x&(1<>>=A,w-=A),w<15&&(x+=I[d++]<>>=A=P>>>24,w-=A,!(16&(A=P>>>16&255))){if(!(64&A)){P=T[(65535&P)+(x&(1<>>=A,w-=A,(A=m-s)>3,x&=(1<<(w-=C<<3))-1,a.next_in=d,a.next_out=m,a.avail_in=d>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function x(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(k){var j;return k&&k.state?(j=k.state,k.total_in=k.total_out=j.total=0,k.msg="",j.wrap&&(k.adler=1&j.wrap),j.mode=v,j.last=0,j.havedict=0,j.dmax=32768,j.head=null,j.hold=0,j.bits=0,j.lencode=j.lendyn=new a.Buf32(y),j.distcode=j.distdyn=new a.Buf32(_),j.sane=1,j.back=-1,o):c}function S(k){var j;return k&&k.state?((j=k.state).wsize=0,j.whave=0,j.wnext=0,w(k)):c}function T(k,j){var I,W;return k&&k.state?(W=k.state,j<0?(I=0,j=-j):(I=1+(j>>4),j<48&&(j&=15)),j&&(j<8||15=U.wsize?(a.arraySet(U.window,j,I-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(W<(L=U.wsize-U.wnext)&&(L=W),a.arraySet(U.window,j,I-W,L,U.wnext),(W-=L)?(a.arraySet(U.window,j,I-W,W,0),U.wnext=W,U.whave=U.wsize):(U.wnext+=L,U.wnext===U.wsize&&(U.wnext=0),U.whave>>8&255,I.check=u(I.check,pe,2,0),Z=X=0,I.mode=2;break}if(I.flags=0,I.head&&(I.head.done=!1),!(1&I.wrap)||(((255&X)<<8)+(X>>8))%31){k.msg="incorrect header check",I.mode=30;break}if((15&X)!=8){k.msg="unknown compression method",I.mode=30;break}if(Z-=4,F=8+(15&(X>>>=4)),I.wbits===0)I.wbits=F;else if(F>I.wbits){k.msg="invalid window size",I.mode=30;break}I.dmax=1<>8&1),512&I.flags&&(pe[0]=255&X,pe[1]=X>>>8&255,I.check=u(I.check,pe,2,0)),Z=X=0,I.mode=3;case 3:for(;Z<32;){if(Y===0)break e;Y--,X+=W[U++]<>>8&255,pe[2]=X>>>16&255,pe[3]=X>>>24&255,I.check=u(I.check,pe,4,0)),Z=X=0,I.mode=4;case 4:for(;Z<16;){if(Y===0)break e;Y--,X+=W[U++]<>8),512&I.flags&&(pe[0]=255&X,pe[1]=X>>>8&255,I.check=u(I.check,pe,2,0)),Z=X=0,I.mode=5;case 5:if(1024&I.flags){for(;Z<16;){if(Y===0)break e;Y--,X+=W[U++]<>>8&255,I.check=u(I.check,pe,2,0)),Z=X=0}else I.head&&(I.head.extra=null);I.mode=6;case 6:if(1024&I.flags&&(Y<(fe=I.length)&&(fe=Y),fe&&(I.head&&(F=I.head.extra_len-I.length,I.head.extra||(I.head.extra=new Array(I.head.extra_len)),a.arraySet(I.head.extra,W,U,fe,F)),512&I.flags&&(I.check=u(I.check,W,fe,U)),Y-=fe,U+=fe,I.length-=fe),I.length))break e;I.length=0,I.mode=7;case 7:if(2048&I.flags){if(Y===0)break e;for(fe=0;F=W[U+fe++],I.head&&F&&I.length<65536&&(I.head.name+=String.fromCharCode(F)),F&&fe>9&1,I.head.done=!0),k.adler=I.check=0,I.mode=12;break;case 10:for(;Z<32;){if(Y===0)break e;Y--,X+=W[U++]<>>=7&Z,Z-=7&Z,I.mode=27;break}for(;Z<3;){if(Y===0)break e;Y--,X+=W[U++]<>>=1)){case 0:I.mode=14;break;case 1:if(C(I),I.mode=20,j!==6)break;X>>>=2,Z-=2;break e;case 2:I.mode=17;break;case 3:k.msg="invalid block type",I.mode=30}X>>>=2,Z-=2;break;case 14:for(X>>>=7&Z,Z-=7&Z;Z<32;){if(Y===0)break e;Y--,X+=W[U++]<>>16^65535)){k.msg="invalid stored block lengths",I.mode=30;break}if(I.length=65535&X,Z=X=0,I.mode=15,j===6)break e;case 15:I.mode=16;case 16:if(fe=I.length){if(Y>>=5,Z-=5,I.ndist=1+(31&X),X>>>=5,Z-=5,I.ncode=4+(15&X),X>>>=4,Z-=4,286>>=3,Z-=3}for(;I.have<19;)I.lens[Be[I.have++]]=0;if(I.lencode=I.lendyn,I.lenbits=7,le={bits:I.lenbits},ge=f(0,I.lens,0,19,I.lencode,0,I.work,le),I.lenbits=le.bits,ge){k.msg="invalid code lengths set",I.mode=30;break}I.have=0,I.mode=19;case 19:for(;I.have>>16&255,K=65535&oe,!((Te=oe>>>24)<=Z);){if(Y===0)break e;Y--,X+=W[U++]<>>=Te,Z-=Te,I.lens[I.have++]=K;else{if(K===16){for(te=Te+2;Z>>=Te,Z-=Te,I.have===0){k.msg="invalid bit length repeat",I.mode=30;break}F=I.lens[I.have-1],fe=3+(3&X),X>>>=2,Z-=2}else if(K===17){for(te=Te+3;Z>>=Te)),X>>>=3,Z-=3}else{for(te=Te+7;Z>>=Te)),X>>>=7,Z-=7}if(I.have+fe>I.nlen+I.ndist){k.msg="invalid bit length repeat",I.mode=30;break}for(;fe--;)I.lens[I.have++]=F}}if(I.mode===30)break;if(I.lens[256]===0){k.msg="invalid code -- missing end-of-block",I.mode=30;break}if(I.lenbits=9,le={bits:I.lenbits},ge=f(m,I.lens,0,I.nlen,I.lencode,0,I.work,le),I.lenbits=le.bits,ge){k.msg="invalid literal/lengths set",I.mode=30;break}if(I.distbits=6,I.distcode=I.distdyn,le={bits:I.distbits},ge=f(s,I.lens,I.nlen,I.ndist,I.distcode,0,I.work,le),I.distbits=le.bits,ge){k.msg="invalid distances set",I.mode=30;break}if(I.mode=20,j===6)break e;case 20:I.mode=21;case 21:if(6<=Y&&258<=B){k.next_out=H,k.avail_out=B,k.next_in=U,k.avail_in=Y,I.hold=X,I.bits=Z,d(k,_e),H=k.next_out,L=k.output,B=k.avail_out,U=k.next_in,W=k.input,Y=k.avail_in,X=I.hold,Z=I.bits,I.mode===12&&(I.back=-1);break}for(I.back=0;G=(oe=I.lencode[X&(1<>>16&255,K=65535&oe,!((Te=oe>>>24)<=Z);){if(Y===0)break e;Y--,X+=W[U++]<>ue)])>>>16&255,K=65535&oe,!(ue+(Te=oe>>>24)<=Z);){if(Y===0)break e;Y--,X+=W[U++]<>>=ue,Z-=ue,I.back+=ue}if(X>>>=Te,Z-=Te,I.back+=Te,I.length=K,G===0){I.mode=26;break}if(32&G){I.back=-1,I.mode=12;break}if(64&G){k.msg="invalid literal/length code",I.mode=30;break}I.extra=15&G,I.mode=22;case 22:if(I.extra){for(te=I.extra;Z>>=I.extra,Z-=I.extra,I.back+=I.extra}I.was=I.length,I.mode=23;case 23:for(;G=(oe=I.distcode[X&(1<>>16&255,K=65535&oe,!((Te=oe>>>24)<=Z);){if(Y===0)break e;Y--,X+=W[U++]<>ue)])>>>16&255,K=65535&oe,!(ue+(Te=oe>>>24)<=Z);){if(Y===0)break e;Y--,X+=W[U++]<>>=ue,Z-=ue,I.back+=ue}if(X>>>=Te,Z-=Te,I.back+=Te,64&G){k.msg="invalid distance code",I.mode=30;break}I.offset=K,I.extra=15&G,I.mode=24;case 24:if(I.extra){for(te=I.extra;Z>>=I.extra,Z-=I.extra,I.back+=I.extra}if(I.offset>I.dmax){k.msg="invalid distance too far back",I.mode=30;break}I.mode=25;case 25:if(B===0)break e;if(fe=_e-B,I.offset>fe){if((fe=I.offset-fe)>I.whave&&I.sane){k.msg="invalid distance too far back",I.mode=30;break}We=fe>I.wnext?(fe-=I.wnext,I.wsize-fe):I.wnext-fe,fe>I.length&&(fe=I.length),ft=I.window}else ft=L,We=H-I.offset,fe=I.length;for(BM?(A=We[ft+_[j]],Z[z+_[j]]):(A=96,0),x=1<>H)+(w-=x)]=P<<24|A<<16|C|0,w!==0;);for(x=1<>=1;if(x!==0?(X&=x-1,X+=x):X=0,j++,--_e[k]==0){if(k===W)break;k=s[o+_[j]]}if(L>>7)]}function z(oe,pe){oe.pending_buf[oe.pending++]=255&pe,oe.pending_buf[oe.pending++]=pe>>>8&255}function _e(oe,pe,Be){oe.bi_valid>b-Be?(oe.bi_buf|=pe<>b-oe.bi_valid,oe.bi_valid+=Be-b):(oe.bi_buf|=pe<>>=1,Be<<=1,0<--pe;);return Be>>>1}function ft(oe,pe,Be){var ze,be,pt=new Array(_+1),Et=0;for(ze=1;ze<=_;ze++)pt[ze]=Et=Et+Be[ze-1]<<1;for(be=0;be<=pe;be++){var Xe=oe[2*be+1];Xe!==0&&(oe[2*be]=We(pt[Xe]++,Xe))}}function Te(oe){var pe;for(pe=0;pe>1;1<=Be;Be--)ue(oe,pt,Be);for(be=Ce;Be=oe.heap[1],oe.heap[1]=oe.heap[oe.heap_len--],ue(oe,pt,1),ze=oe.heap[1],oe.heap[--oe.heap_max]=Be,oe.heap[--oe.heap_max]=ze,pt[2*be]=pt[2*Be]+pt[2*ze],oe.depth[be]=(oe.depth[Be]>=oe.depth[ze]?oe.depth[Be]:oe.depth[ze])+1,pt[2*Be+1]=pt[2*ze+1]=be,oe.heap[1]=be++,ue(oe,pt,1),2<=oe.heap_len;);oe.heap[--oe.heap_max]=oe.heap[1],function(xt,Pt){var Nt,Yt,Vt,$t,Rt,ee,ce=Pt.dyn_tree,wt=Pt.max_code,Ct=Pt.stat_desc.static_tree,It=Pt.stat_desc.has_stree,Dt=Pt.stat_desc.extra_bits,rn=Pt.stat_desc.extra_base,tn=Pt.stat_desc.max_length,Ot=0;for($t=0;$t<=_;$t++)xt.bl_count[$t]=0;for(ce[2*xt.heap[xt.heap_max]+1]=0,Nt=xt.heap_max+1;Nt>=7;be>>=1)if(1&bt&&Xe.dyn_ltree[2*Ce]!==0)return l;if(Xe.dyn_ltree[18]!==0||Xe.dyn_ltree[20]!==0||Xe.dyn_ltree[26]!==0)return u;for(Ce=32;Ce>>3,(pt=oe.static_len+3+7>>>3)<=be&&(be=pt)):be=pt=Be+5,Be+4<=be&&pe!==-1?te(oe,pe,Be,ze):oe.strategy===4||pt===be?(_e(oe,2+(ze?1:0),3),ke(oe,D,k)):(_e(oe,4+(ze?1:0),3),function(Xe,Ce,bt,xt){var Pt;for(_e(Xe,Ce-257,5),_e(Xe,bt-1,5),_e(Xe,xt-4,4),Pt=0;Pt>>8&255,oe.pending_buf[oe.d_buf+2*oe.last_lit+1]=255&pe,oe.pending_buf[oe.l_buf+oe.last_lit]=255&Be,oe.last_lit++,pe===0?oe.dyn_ltree[2*Be]++:(oe.matches++,pe--,oe.dyn_ltree[2*(I[Be]+s+1)]++,oe.dyn_dtree[2*Z(pe)]++),oe.last_lit===oe.lit_bufsize-1},i._tr_align=function(oe){_e(oe,2,3),fe(oe,w,D),function(pe){pe.bi_valid===16?(z(pe,pe.bi_buf),pe.bi_buf=0,pe.bi_valid=0):8<=pe.bi_valid&&(pe.pending_buf[pe.pending++]=255&pe.bi_buf,pe.bi_buf>>=8,pe.bi_valid-=8)}(oe)}},{"../utils/common":41}],53:[function(t,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,i){(function(a){(function(l,u){if(!l.setImmediate){var d,f,m,s,o=1,c={},v=!1,y=l.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(l);_=_&&_.setTimeout?_:l,d={}.toString.call(l.process)==="[object process]"?function(S){process.nextTick(function(){x(S)})}:function(){if(l.postMessage&&!l.importScripts){var S=!0,T=l.onmessage;return l.onmessage=function(){S=!1},l.postMessage("","*"),l.onmessage=T,S}}()?(s="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",w,!1):l.attachEvent("onmessage",w),function(S){l.postMessage(s+S,"*")}):l.MessageChannel?((m=new MessageChannel).port1.onmessage=function(S){x(S.data)},function(S){m.port2.postMessage(S)}):y&&"onreadystatechange"in y.createElement("script")?(f=y.documentElement,function(S){var T=y.createElement("script");T.onreadystatechange=function(){x(S),T.onreadystatechange=null,f.removeChild(T),T=null},f.appendChild(T)}):function(S){setTimeout(x,0,S)},_.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var T=new Array(arguments.length-1),E=0;E"u"?a===void 0?this:a:self)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(jszip_min)),jszip_min.exports}var jszip_minExports=requireJszip_min();const JSZip=getDefaultExportFromCjs(jszip_minExports);ZipLoader.zipReader=(r,e)=>JSZip.loadAsync(r);ZipLoader.readText=(r,e)=>{const t=r.file(e);if(!t)throw new Error(`Cannot find file: ${e}`);return t.async("text")};ZipLoader.getFilePaths=r=>{const e=[];return r.forEach(t=>e.push(t)),Promise.resolve(e)};ZipLoader.getFiles=(r,e)=>Promise.all(e.map(async t=>{const n=t.slice(t.lastIndexOf("/")+1),i=await r.file(t).async("blob");return new File([i],n)}));const _hoisted_1$1={relative:""},_hoisted_2$1={"h-full":"","w-full":""},_hoisted_3={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"pink-600","px-2":"","py-2":"",transform:"translate-x--1/2"},_hoisted_4={bg:"pink-50","rounded-xl":"","px-10":"","py-6":""},_hoisted_5=["innerHTML"],_sfc_main$1=defineComponent({__name:"Stage",setup(r){const e=ref$1(),t=ref$1(),{stageView:n,elevenLabsApiKey:i,elevenlabsVoiceEnglish:a,elevenlabsVoiceJapanese:l}=storeToRefs(useSettings()),{mouthOpenSize:u}=storeToRefs(useSpeakingStore()),{audioContext:d,calculateVolume:f}=useAudioContext(),{onBeforeMessageComposed:m,onBeforeSend:s,onTokenLiteral:o,onTokenSpecial:c,onStreamEnd:v,streamingMessage:y}=useChatStore(),{process:_}=useMarkdown(),{locale:b}=useI18n(),x=ref$1(),w=ref$1(!1),S=ref$1(!1),T=useQueue({handlers:[I=>new Promise(W=>{const L=d.createBufferSource();L.buffer=I.data.audioBuffer,L.connect(d.destination),L.connect(x.value),w.value=!0,L.start(0),L.onended=()=>{w.value=!1,W()}})]}),E=useQueue({handlers:[async I=>{let W=Voice.Camilla_KM;b.value==="jp"||b.value==="jp-JP"?W=l.value:W=a.value;const L=Date.now(),U=createUnElevenLabs({apiKey:i.value,baseURL:"https://unspeech.hyp3r.link/v1/"}),H=await generateSpeech({...U.speech({model:"elevenlabs/eleven_multilingual_v2",voice:voiceMap[W],voiceSettings:{stability:.4,similarityBoost:.5}}),input:I.data}),Y=Date.now()-L;console.debug("TTS took",Y,"ms");const B=await d.decodeAudioData(H);await T.add({audioBuffer:B,text:I.data})}]});E.on("add",I=>{console.debug("ttsQueue added",I)});const M=useMessageContentQueue(E),P=useQueue({handlers:[async I=>{if(n.value==="3d"){const W=EMOTION_VRMExpressionName_value[I.data];if(!W)return;await t.value.setExpression(W)}else n.value==="2d"&&await e.value.setMotion(EMOTION_EmotionMotionName_value[I.data])}]}),A=useEmotionsMessageQueue(P);A.onHandlerEvent("emotion",I=>{console.debug("emotion detected",I)});const C=useDelayMessageQueue();C.onHandlerEvent("delay",I=>{console.debug("delay detected",I)});function D(){requestAnimationFrame(D),w.value&&(u.value=f(x.value,"linear"))}function k(){S.value||(D(),d.resume(),S.value=!0)}function j(){x.value||(x.value=d.createAnalyser())}return m(async()=>{j(),k()}),s(async()=>{var I;(I=e.value)==null||I.setMotion(EmotionThinkMotionName)}),o(async I=>{await M.add(I)}),c(async I=>{await C.add(I),await A.add(I)}),v(async()=>{await C.add(llmInferenceEndToken)}),onUnmounted(()=>{S.value=!1}),(I,W)=>(openBlock(),createElementBlock("div",_hoisted_1$1,[createBaseVNode("div",_hoisted_2$1,[unref(n)==="2d"?(openBlock(),createBlock(_sfc_main$6,{key:0,ref_key:"live2DViewerRef",ref:e,"mouth-open-size":unref(u),model:"./assets/live2d/models/hiyori_pro_zh.zip","min-w":"50% (openBlock(),createBlock(Cross,{"h-full":"","w-full":""},{default:withCtx(()=>[createVNode(_sfc_main$i,{"h-full":"","w-full":"","fill-color":unref(e)?"#563544":"#f8e8f2"},{default:withCtx(()=>[createBaseVNode("div",_hoisted_1,[createVNode(_sfc_main$f,{class:"flex